How to get total pages from a Word Document?

I want have created a program with ABAP, It'll print the cover page with form, the detail infomation is in a word document on a file server. I want to display the total pages in the cover page, how can I do? In another word, how to calculate the pages for a word document in sap ?

I don't know how to use it. My test codes:
REPORT print_via_ole_example .
INCLUDE ole2incl .
DATA: gs_word TYPE ole2_object ,
gs_documents TYPE ole2_object ,
gs_newdoc TYPE ole2_object ,
gs_actdoc TYPE ole2_object ,
gs_application type ole2_object,
gs_document type ole2_object ,
gs_docproperty type ole2_object,
p_pages type p .
START-OF-SELECTION .
CREATE OBJECT gs_word 'WORD.APPLICATION'.
SET PROPERTY OF gs_word 'Visible' = '0' .
CALL METHOD OF gs_word 'Documents' = gs_documents.
CALL METHOD OF gs_documents 'Open'
EXPORTING #1 = 'd:\test.doc' .
CALL METHOD OF gs_word 'ActiveDocument' = gs_actdoc .
get property of gs_actdoc 'Application' = gs_application .
get property of gs_actdoc 'BuiltinDocumentProperties' = gs_docproperty .
get property of gs_docproperty 'wdPropertyPages' = p_pages.
CALL METHOD OF gs_actdoc 'PrintOut' .
CALL METHOD OF gs_documents  'CLOSE' .
CALL METHOD OF gs_word 'Quit' .
new-line.
END-OF-SELECTION.
FREE: gs_word, gs_actdoc, gs_documents, gs_newdoc .
When run it, I can not get the total pages, and winword.exe hung up, can only be terminated in Task Manager.
Could you help me to modify this test code?
Thank you .

Similar Messages

  • How can one print a particular page or pages from a Word Document using ActiveX or any other technique?

    I've been trying to print  a few pages from a Word document.
    Currently I am able to print the entire document using some ActiveX techniques.
    There seems to be facilities for selecting the particular pages, however so far I cannot get them to work.
    I have tried the From/To and the Pages in the PrintOut invoke node.
    And as you will see I have also tried the Range node.
    Anyone have some ideas on how to do this?
    Please see the attached vi.
    Thanks,
    Chris
    Attachments:
    ActiveX Print.vi ‏15 KB

    Please stick to your original post.
    Please have some patience.

  • How do extract one page from one pdf document and save as a new pdf?

    How do I extract one page from a pdf document and create a new document?

    In Acrobat: Tools - Pages - Extract.
    In Reader it's not possible.
    On Sat, Jan 31, 2015 at 10:29 PM, Ned Murphy <[email protected]>

  • How to get total page count (in footer) for just a section?

    In Pages 08, I was able to put a total page count (for only a section) in the footer. However, when I tried doing the same thing in Pages 09, it keeps giving me a total page count for the entire document. I used the same settings for Pages 08 and 09, but 09 keeps giving me the total page count for the entire document. Does anyone know how I can make it work like it did in Pages 08? This is really annoying and preventing me from buying iWork 09 as I need this feature to work. Thanks in advance!

    As far as I know, the Pages '08 behavior was a bug.
    The Pages '09 Help states:
    Here are ways to work with information about a document:
    To add or change descriptive information about a document (author, title, comments, and keywords), click Inspector in the toolbar, click the Document button, and then click Info. Enter or change information in the fields in the pane.
    This information is searchable using Spotlight on computers with Mac OS X version 10.4 and later.
    _To display document statistics, such as number of words, pages, lines, paragraphs, sections, graphics, and characters in the document_, click Inspector in the toolbar, click the Document button, and then click Info.
    _A document’s word and page count_ are always visible at the bottom left of the window. To hide your document’s word count, choose Pages > Preferences, and then deselect “Show word count at window bottom.”
    If a range of text is selected, you can specify the extent of the displayed statistics by choosing Selection or Document from the Range pop-up menu in the Document inspector.
    This time it's clear that except if you select a chunk of text, word count and page count are global document 's properties.
    Yvan KOENIG (from FRANCE lundi 2 février 2009 11:48:56)

  • How to get total value from checkbox list?

    I have a list of checkbox items - all number values. I want to then get the total value from all of the check items and add that value to the database. Can this be done?
    Also, anyone know of one source where I can get detailed information on how to best use Web Apps and all of it's possibilities and limitations? Most of the tutorials that I have seen so far say that you can do most anything with Web Apps; however, the tutorial examples leave a lot of questions unanswered. I saw that Adobe has an article that shows how to build a basic web app and that it is "part 1" in a series. Anyone know where to find parts 2, 3, etc?
    Thanks,

    Hi there,
    Good day, i hope this will give you some ideas
    for example this is your html
    <input type="checkbox" name="test" value="1">1
    <input type="checkbox" name="test" value="2">2
    <input type="checkbox" name="test" value="3">3
    <input type="checkbox" name="test" value="4">4
    and this is your jquery script
    <script type="text/javascript">
    jQuery("input@[name='test']").click(function() {
        var istrue = jQuery(this).is(":checked");
        if(istrue == true) {
            var urvalue = jQuery(this).val();
            alert(urvalue);
    </script>
    hope this helps you

  • How do I view comments from a Word document in Pages 09?

    I have a word document with comments to the right of it, but when I open it using Pages 09 I don't see them. I've gone to View->View Comments but nothing comes up.

    Word and Pages use different methods for many things and are not wholly compatible.
    I guess you have found another aspect that doesn't translate.
    Do a few simple examples in both Pages and Word and see what does translate or not. Then know thte limitations.
    Peter

  • How to save a page as a word document?

    I have a a page with all the data entered in its fileds, is there any possible way by which i can save it as a word document.

    Once the document is saved as say HTML or formatted text, you could use the OpenOffice engine (which would run on the server), and convert the document to Word format (or PDF, etc.).
    http://codesnippets.services.openoffice.org/Office/Office.ConvertDocuments.snip
    OpenOffice runs as a background process, and with the above code (which is a servlet) the converted document is returned.

  • How Can I extract pages from a PDF document into a separate document by clicking a link?

    Hi,
    I have created a large PDF document with several pages, I have a link symbol on the contents page of the document that relates to several services on different pages within the document. Currently they are identified by having the same link symbol on every page that relates to that particular service. I was wondering if there was any way in which I can create a interactive pdf, when I click the initial symbol link on the contents, it collates all the relevant linked service pages into a single document or guides the viewer to all the pages without having to create a separate pdf document for each service?
    Many thanks
    Yunus

    Simple answer - no. PDF files cannot reassemble themselves into new documents, nor can you hide pages.

  • How to get last page number in word report? LV

    I'm trying to find out where am I when I use LV to generate word report. I would like automatic generate page index in front of report.
    Thanks in advance

    Ed,
    Are you using DIAdem with labview to generate your report in LabVIEW? If so can you please explain your setup a little more. If you aren't using DIAdem you may find more labVIEW users if you post on the LabVIEW forums: http://forums.ni.com/ni/board?board.id=170 . Either way let me know.
    Richard S -- National Instruments --Applications Engineer -- Data Acquisition with TestStand

  • How do I extract pages from an accessible document and keep the tags?

    I have a 300 page document that contains tags. I need to extract 5 pages with complex <Table>  structures and maintain the tags. I also want to Import the same pages into another document while maintaining the Tags.
    My efforts this far gives the 5 extracted pages and there are Tags but they no longer seem connected to the pages.
    Am I asking too much?

    Thank you very much for the assistance. I ended up deleting all of the pages and Tags but those that I wanted to "export". Saving that as a file and combining it successfully.
    I did indeed follow the instructions for Extracting, but as with many things in Acrobat, it has its issues.
    Here is what I think happened that ensured failure before. First I assumed that if I export the pages the Tags "belonging" to those pages would export as well without difficulty. For each page I created a new Section and named it for the page number. So with the auto-tagging completed I created Section for each page and moved the Tags under the proper Sections. However I had not completed the process for the entire document when I needed to do the Export. I apparently left Tags belonging to later pages in the document (they were buried in Sections of Sections).
    When I originally exported, I had the pages I wanted and a lot of Tags relating to pages at the beginning of the document as well as Tags for pages near the end of the document. Clearly the Tags (in the Tag View) for the pages not exported were dead. But so were the Tags for the pages that were exported.
    I expect that not having the Tags in proper order made Acrobat lose its mind during the export process.

  • How do I stop pages from locking my documents when I don't access them for a while?

    Every time I open up a document I've not looked at for a little while, Pages decides to lock it. It's not a big deal, it's just an annoyance with absolutely no obvious use that I wish I could be rid of.

    You can't turn it off entirely, but you can change the period of time before documents lock in the Options tab of Time Machine Preferences.

  • How to get attribute value from standard page ?

    Hi,
    How to get attribute value from standard page ?
    String str = (String)vo.getCurrentRow().getAttrbute("RunId");
    But this value is returning a null value ....
    Can anyone help me to get this attribute value which is actually having a actual value .

    getCurrentRow() would always return null if no setCurrentRow() is used.
    Please check the page design and understand how many rows of VO are there. You can also use the following to get the row:
    vo.reset();
    vo.next();
    Regards
    Sumit

  • Quick doubt.. from cursor vairable how to get into page vairable

    Hello
    i am creating an apex page where i have 2 regions. From the Top region stores all fields entered into the bottom region
    Text fields like first name and last name and address fields are in region 2(bottom).After region 2, i have a add person button.
    Once i click add person, that person will get into top i.e region 1.
    Now, Region 1 got person1 first name ,last name
    person2, first name,last name
    etc..
    I am not able to display like p1_first_name,p1_laast_name as the list is not stable..it is growing and not showing the person who already got saved..I can retrieve them from DB using a cursor..But from cursor vairable how to get into page vairable..
    appreciate ur help..
    kp

    Your explanation is not good enough. You have to make a better description of your problem or create an example at apex.oracle.com.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.apress.com/9781430235125
    http://apex.oracle.com/pls/apex/f?p=31517:1
    http://www.amazon.de/Oracle-APEX-XE-Praxis/dp/3826655494
    -------------------------------------------------------------------

  • How do I save documents from the new Pages into a Word Document

    How do I save documents from the new Pages into a Word Document?

    Thank you so much - so simple!  I had been using the 'share' option (worked in old Pages) and only had icloud or email as options.  I have to attach word documents to emails to send to work. I don't want to use icloud because it's too public and I don't trust it.  Also, you have to be able to access the internet and I need word documents on my USB stick for work where there's no internet.
    I love my Mac but I do wish Apple would remember those of us living in less-than-perfect computer-land.
    Thanks again
    Lindsay

  • HOW CAN I IMPORT TEXT FROM MICROSOFT WORD TO THE WEB PAGE?

    HOW CAN I IMPORT TEXT FROM MICROSOFT WORD TO THE WEB PAGE?

    Another method is tosave your Word document as an a web page.  Then open the htm file, copy the text and paste into an HTML snippet on your web page.  Resize to show all the document and publish. It will retain the style, font and alignment of the original Word document.
    OT

Maybe you are looking for