none
"Save Copy As" In Word RRS feed

  • Question

  • I am working on my word addin for office 2010. I need savecopyas api (excel and powerpoint have it). Since there is no savecopyas api available in word. I used IPersistFile interface to implement save copy as. I found it here :

    http://blogs.msdn.com/b/pranavwagh/archive/2008/04/03/how-to-do-a-save-copy-as-in-word.aspx

    Saved copy document has number of issues in it. For e.g number of pages information is wrong. I checked app.xml in docProps. Number of pages is always 1 with this workaround.

    Any ideas??

    Thanks in advance.

    Wednesday, March 5, 2014 11:04 AM

Answers

  • It would be interesting to know what the other issues are before making suggestions, however...

    For many things, Word relies on actually opening a document in the application window (visible) in order for its layout engine to perform the necessary calculations. My guess is that, when you use the method described, since this does not take place certain things are not "initialized", such as pagination.

    The only workaround that occurs to me would be to open this new document in Word, which is probably not something you want to do...

    Beyond that, you could SaveAs to a new document name. Or close the document, copy the file, then re-open it.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, March 6, 2014 6:38 AM
    Moderator
  • Hi,

    Firstly, have you tried using Word PIA in this case? Is the result same?

    What do you mean by page count is incorrect’?

    Could you please upload a figure or give us a sample (without using Aspose) to reproduce the issue?

    Secondly, Aspose is not supported here. If you have any question about Aspose, you would get support from their site. (http://www.aspose.com/community/forums/default.aspx)

    Thirdly, as Cindy mentioned, you could try using Document.SaveAs Method.

    For more information, please refer to IPersistFile::Save method.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 6, 2014 9:21 AM
    Moderator

All replies

  • I am working on my word addin for office 2010. I need savecopyas api (excel and powerpoint have it). Since there is no savecopyas api available in word. I used IPersistFile interface to implement save copy as. I found it here :

    http://blogs.msdn.com/b/pranavwagh/archive/2008/04/03/how-to-do-a-save-copy-as-in-word.aspx

    Saved copy document has number of issues in it. For e.g number of pages information is wrong. I checked app.xml in docProps. Number of pages is always 1 with this workaround.

    Any ideas??

    Thanks in advance.


     
    Wednesday, March 5, 2014 9:43 AM
  • Hello Asingh,

    It looks like the issue is not related to VSTO at all. That's why I'd suggest asking Word related questions in the Word for Developers forum instead. There you will get the most qualified answers.

    Did you try to open the saved copy in Word? Do you see the correct number of pages?

    Wednesday, March 5, 2014 10:58 AM
  • Hello Asingh,

    Did you try to open the saved copy in Word? Do you see the correct number of pages?

    Wednesday, March 5, 2014 11:34 AM
  • Hi Eugene Astafiev,

    Number of Pages is not populated in info tab. But my requirement is bit different. Saved copy of file is used by Aspose library. When it reads the document, page count is incorrect bacause of bug in the save copy as workaround.



    • Edited by asingh.net Wednesday, March 5, 2014 12:26 PM
    Wednesday, March 5, 2014 12:25 PM
  • It would be interesting to know what the other issues are before making suggestions, however...

    For many things, Word relies on actually opening a document in the application window (visible) in order for its layout engine to perform the necessary calculations. My guess is that, when you use the method described, since this does not take place certain things are not "initialized", such as pagination.

    The only workaround that occurs to me would be to open this new document in Word, which is probably not something you want to do...

    Beyond that, you could SaveAs to a new document name. Or close the document, copy the file, then re-open it.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, March 6, 2014 6:38 AM
    Moderator
  • Hi,

    Firstly, have you tried using Word PIA in this case? Is the result same?

    What do you mean by page count is incorrect’?

    Could you please upload a figure or give us a sample (without using Aspose) to reproduce the issue?

    Secondly, Aspose is not supported here. If you have any question about Aspose, you would get support from their site. (http://www.aspose.com/community/forums/default.aspx)

    Thirdly, as Cindy mentioned, you could try using Document.SaveAs Method.

    For more information, please refer to IPersistFile::Save method.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, March 6, 2014 9:21 AM
    Moderator