Creating table in MS Word document via OLE: how can I specify column width

What method and properties do I need to use in order to specify the width of each column in a MSWord table created via ABAP using OLE ?  Or, better yet, how can I create a table where the columns are sized using the Autofit feature?
I am already familiar with the standard sample code for creating a word document that contains a table (found in ZOLE_WORD_DOC_CREATE).
Tom Eshelman

I found a solution - although I would still be interested if anyone knows how to turn on autofit when creating a table,  The following code can be used to specify the width of one cell at the same time it is filled with data.  I found this in an old SDN posting.
FORM write_cell_in_table  USING    p_row
                                   p_col
                                   p_text
                                   p_font
                                   p_size
                                   p_bold
                                   p_color
                                   p_width
                                   p_underline.
                                  P_ALIGNMENT.
  DATA: l_len TYPE i.
  l_len = STRLEN( p_text ).
  IF l_len IS INITIAL.
    l_len = 1.
  ENDIF.
*--Getting cell coordinates
  CALL METHOD OF gs_table 'Cell' = gs_cell
  EXPORTING : #1 = p_row "first row
              #2 = p_col. "first column
*--Getting the range handle to write the text
  GET PROPERTY OF gs_cell 'Range' = gs_range .
  IF p_width > 0 AND l_len > 1.
    SET PROPERTY OF gs_cell 'PreferredWidth' = p_width.
  ENDIF.
*--Filling the cell
  GET PROPERTY OF gs_range 'Font' = gs_font .
  SET PROPERTY OF gs_font 'Name' = p_font .
  SET PROPERTY OF gs_font 'Size' = p_size .
  SET PROPERTY OF gs_font 'Bold' = p_bold . "Not bold
  SET PROPERTY OF gs_font 'Underline' = p_underline . "Double line
  GET PROPERTY OF gs_cell 'Shading' = gs_shading .
  SET PROPERTY OF gs_shading 'BackgroundPatternColorIndex' = p_color.
  SET PROPERTY OF gs_range 'Text' = p_text(l_len) .
ENDFORM.                    " write_cell_in_table

Similar Messages

  • Hi Sir! I have some questions regarding word report generation please.1.How can i add border to a word page?.2.How can i add grid lines to a table generated in word report?.3.How can i add border to a table of word report?.Thanks Imran Pakistan

    Hi !
    Sir I have some questions regarding word report generation using(C language in labwindows) Please.
    1.How can i add border to a word page?.
    2.How can i add border and grid lines to a table generated in word report(Not the " cvi table control" inserted from gui,i am asking about the table generated in word report)?
    3.How can i fill a cell of word report table withe the data type other than "character"?.
    And sir one question about use of timer in cvi labwindows please.
    Sir i'm trying to set minimum delay interval of timer control to 1millisecond(0.001s),as i set ,timer don't cares of the interval that is set by me it responds only to the default minimum time interval which is i think 10milliseconds(i'am using windows xp service pack3 version 2002).
    Regards
    Imran
    Pakistan
    Solved!
    Go to Solution.

    Hello sir!
    Sir i'm using daq6251.But Sir before implimenting it to my final application now i'm just trying to achieve 1millisecond time interval for timer in a vary simple programe i mean at this time no hardware (daq device) is  involved i,m just trying to achieve minimum time interval of 1millisecond.
    Sir i read form "help" of labwindows how this time interval can be set,i'm trying for,as described in help notes but i could'nt.I'm attaching a screen shot sir for you it may helpful for you to explain me.
    And sir also waiting for your kind reply regarding word report generation.
    Thanks.
    Imran.
    Attachments:
    screen_shot_rigistry.docx ‏65 KB

  • Desktop office integration : Creating and filling tables in a word document

    Hi all,
    I want to create a table in a word document and then fill it with data. The word processor interface has only 'insert_table' methods which can download the data in an ABAP internal table to an already
    existing table in a word document, but in my case I also want to create the word table,  titles etc. in the word document. Has someone experience with such kind of a requirement or have someone an example for it? 
    Kind Regards,
    Sükrü

    Hi,
    May this one will help you.
    CREATE OBJECT wordapp 'Word.Application'.
    CALL METHOD OF wordapp 'Documents' = documents.
    CALL METHOD OF documents 'Add' = thisdoc.
    CALL METHOD OF thisdoc 'Activate'.
    GET PROPERTY OF wordapp 'Selection' = selection.
    SET PROPERTY OF wordapp 'Visible' = 1.
    CALL METHOD OF selection 'TypeParagraph'.
    CALL METHOD OF selection 'TypeText'
      EXPORTING #1 = 'New Document'.
    GET PROPERTY OF wordapp 'Tables' = tables.
    CALL METHOD OF tables 'Add' = thistable.
    SET PROPERTY OF thistable 'NumRows' = 2.
    SET PROPERTY OF thistable 'NumColumns' = 2.
    or you can check
    CALL METHOD OF wordobj 'TABLEINSERTTABLE'
    EXPORTING
    #01 = 2
    #02 = 3.
    aRs

  • SAP OLE - Create Hyperling on a Word Document

    Hi,
    My next step of creating a word document using OLE is to define some hyperlinks on a document. I have ran a macro in word to 'see what it does' when manually creating a hyperlink. Below is the macro: -
        ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:="", _
            SubAddress:="_Program_Z_OPEN_HRS_UPD_WRF1", ScreenTip:="", TextToDisplay _
            :="This is the program"
    I have tried to implement this using ABAP with no success. Maybe because I still dont fully understand how to interprete these marcos as ABAP.
    Has anybody created a hyperlink on a word document before, if so, seeing the code would be a great help.
    Thanks
    Martin
    Edited by: Martin Shinks on Dec 21, 2011 9:52 AM

    Never mind, with a bit of jiggery pokery, I fixed it myself.

  • Excel table in a word document coming up black during pdf convert

    I am converting word 2003 documents to pdf using adobe professional 7.0 and an excel table inside the word document is coming out as completely filled in black after the convert.
    any help would be much appreciated.
    Thanks tim

    If you are having problems creating a PDF, there are two steps you should do FIRST
    Go to the appropriate vendor web site and apply all updates to the program you are using (several recent messages have concerned problems with MS Word conversion, with the response that different versions of Word have different BUGS that must be fixed by a download from Microsoft - and MS Office products are not the only ones which may, from time to time, need to be updated to work properly)
    Go to the Acrobat update page and apply the updates for your version of Acrobat
    IN NUMBER ORDER (updates are not cumulative so, using version 8 as an example, you must apply 8.1.0 before the 8.1.1 update)
    http://www.adobe.com/support/downloads/product.jsp?product=1&platform=Windows
    Acrobat 7.0 has several updates to apply

  • Why iCloud only allows store documents created by Pages, Numbers or Key Note ? How can I "iCloud" documents created with Word Mac or Excel mac??

    Why iCloud only allows store documents created by Pages, Numbers or Key Note ? How can I "iCloud" documents created with Word Mac or Excel mac??

    Oscar66 wrote:
    Why iCloud only allows store documents created by Pages, Numbers or Key Note ? How can I "iCloud" documents created with Word Mac or Excel mac??
    iwork for ios accepts for upload and also happily opens all your Microsoft office files, from Office97 standard doc/xls/ppt to the 2011 versions of docx,xlsx,pptx and various other of these format extensions.
    Notice : the upload feature in www.icloud.com is only active if you in fact own these apps on your iPhone/Pad/pod. it is not a feature of iWork for the Mac ( iwork09 ) which itself is not icloud capable at all.

  • When I receive word documents via my yahoo on my mac, the format always come up as a TEXTEDIT doc.  This is causing me serious problems.  How do I enable my documents to open in the original format it was sent?

    when I receive word documents via my yahoo on my mac, the format always come up as a TEXTEDIT doc.  This is causing me serious problems.  How do I enable my documents to open in the original format it was sent?

    Do you have Microsoft Word installed on your Mac? If so, you can reassign all .doc files to Word by selecting the file in Finder and choosing "File > Get Info" from the menu. In the window that opens look for "Open with" and change the entry to "Microsoft Word".

  • I used to be able to send document as a PDF or Word Document via email using the toolbar.

    I used to be able to send Pages documents as a PDF or Word Document via email using the Pages toolbar (not the iWork feature).  Lately, it hasn't been working at all.  No email pops up; just nothing.  Is anyone else having this problem?  Any solutions?  I'm running Pages '09 version 4.1.

    This Apple Express Helper is a dumb one.
    File names with # and $ are perfectly treated by the share to Mail feature.
    What is rejected is the slash (/) and it's perfectly normal.
    Since the delivery of the first version of OS X, slash is an illegal character in file names.
    Apple thought that it would be fair to build a piece of code taking care of such chars because they were valid ones in the older operating systems.
    But they expected that users will drop these chars. Alas they didn't and users like you are continuing to play with matches.
    At last, OS X 10.7 removed the extraneous code and now, hosanna, iWork refuse to export files whose name contain the infamous slash.
    Yvan KOENIG (VALLAURIS, France) lundi 9 avril 2012
    iMac 21”5, i7, 2.8 GHz, 12 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.3
    My Box account  is : http://www.box.com/s/00qnssoyeq2xvc22ra4k

  • Adobe v9 on W7 and office 2007. cannot create PDF from MS word using Adobe. But can from Excel, PPT

    Adobe v9 on W7 and office 2007. cannot create PDF from MS word using Adobe. But can from Excel, PPT and other MS office apps. Reinslalled Adobe, updated Office, and Adobe no help! Also I can create a pdf from the MS Word and it is using the Adobe 9. So one would think that's good. No it isn't when you need to combine different files to one big PDF document. Any suggetions? Thank you

    Yes, I’m saying that I can in WORD use “Save As ADOBE pdf” but cannot in ADOBE create a pdf file from a WORD (.doc or .docx) document. While I can from other MS Office apps like Excel and PowerPoint.
    I understand I can use “work around” and save doc in WORD as pdf then compile all files needed (xml, ppt, pdf) in the ADOBE v9. to one big pdf document. But that is not the point of this post.  
    Jarda @ PC+NET Solutions
    Mobile 613-532-7023
    Office  613-385-1268
    <http://www.pcplusnet.net/> www.pcplusnet.net

  • While creating a device category i'm getting an error "enter a valid division via eg01,how can the error be overcom?

    While creating a device category i'm getting an error "enter a valid division via eg01,how can the error be overcome?

    Neha,
    you can do in two ways.
    1. Enter a valid Division which you configured in the system.
    2. Remove the Division as required field. However I suggest it should have a valid division. Why can not you check with your Functional owner?
    Linganna Katigiri

  • I need a word document generator, that has a bar to enter equations similar to the Microsoft word program. The document needs to be able to be saved as a word document so my professors can open it in windows. HELP!!

    I need a word document generator, that has a bar to enter equations similar to the Microsoft word program. The document needs to be able to be saved as a word document so my professors can open it in windows. HELP!! My computer is 2012 iMac desktop

    Not sure if any of the alternatives to Office (word) for Mac are near the feature set you require.
    There are a few listed here at this page, in some ways aren't exactly like Office or Word; the feature you seek may (or may not) exist. I'd try & see about neooffice compatibility...
    http://www.digitaltrends.com/computing/best-microsoft-office-alternatives/
    http://www.neooffice.org/neojava/en/index.php
    http://www.libreoffice.org/
    Good luck & happy computing!

  • Simple question:  I want to use iCloud as a back up disk for my documents folder.  How can I do this?  If I cannot do this, why am I paying for access to "the cloud?"

    Simple question:  I want to use iCloud as a back up disk for my documents folder.  How can I do this?  If I cannot do this, why am I paying for access to "the cloud?"

    iCloud does not provide general file storage or backup, so you cannot back up your Documents folder using it. You will need to find a third-party alternative - this page examines some options (some are free):
    http://rfwilmut.net/missing3
    iCloud at basic level, with 5GB is storage, is free: you only pay anything if you want to increase the storage space.

  • My itunes cannot be update on my windows xp. so i delete my itunes and install new, but now i got new problems, it says "The file itune.library.itl cannot be read because it was created by newer version of itunes." so how can it be solved?

    my itunes cannot be update on my windows xp. so i delete my itunes and install new, but now i got new problems, it says "The file itune.library.itl cannot be read because it was created by newer version of itunes." so how can it be solved?

    Hello Bebyida,
    Thanks for using Apple Support Communities.
    For more information on this, take a look at:
    http://www.apple.com/itunes/download/
    Best of luck,
    Mario

  • I am getting this message"The files ITunesLibrary.it cannot be read because it was created by a newer version of iTunes.  How can I add itunes so I can access my music?

    I was told to uninstall my itunes and reinstall.  After doing that, I am getting this message,"The files iTunesLibrary.it cannot be read because it was created by a newer version of iTunes".  How can I get my music back on the computer?

    Hi there catbarn111,
    You may want to try re-creating the iTunes Library as an initial troubleshooting step. Take a look at the article below for more information.
    iTunes: How to re-create your iTunes library and playlists
    http://support.apple.com/kb/ht1451
    -Griff W.

  • What are the tools to create a digital magazine for ipad version and how can be place it in newsstand?

    Hello..
    "what are the tools to create a digital magazine for ipad version and how can be place it in newsstand?"
    I am very tired after done a week of R&D on this issue..
    But i doesn't get any fair solution for this one..
    I hope this is best option to place my issue here to get quick solution..
    Thanks and Regards..

    We are all users here.
    There is no one here from Apple.
    In order for you to develop and distribute content for the iPad, you need to become an apps developer.
    Not sure where you sign up for this or who you have to call.
    There should be a place on Apple's site that refers to a section of the site if you want to be an Apple iOS content developer.
    It cost, I believe $99 U.S. to become an Apple apps developer. You'll agree to Apple's Non-disclosure rules.  You'll receive Apple's app/software developers kit,and access to Apple's app developer site.
    No one here is going to be able to help you.
    Good Luck.

Maybe you are looking for