lohaium.blogg.se

Word count microsoft word
Word count microsoft word









The original page count will show 2 pages but the new page count will show 3. Int32 newPageCount = wordDoc.ComputeStatistics(, Type.Missing)

word count microsoft word

Word.Document _newDocument = (Type.Missing, Type.Missing, Type.Missing, Visible: false) Int32 originalPageCount = wordDoc.ComputeStatistics(, Type.Missing) Once the button for the ribbon is clicked it calls a method that copies the existing document into a new document (the original cannot be modified): I have found a solution that I am putting here to help others who might stumble across this: Use a Macro - it must be done with managed code. This is a C# Add-In to Microsoft Word 2010 using MS Visual Studio 2010 and the Interop.Word if version v7.

Word count microsoft word code#

My project is on a closed network and the documents themselves cannot be shared nor can the code (without retyping it). Thanks for helping make community forums a great place. 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. Sub test()ĭebug.Print ActiveDocument.ComputeStatistics(wdStatisticPages) The result is incorrect, I suggest you repairing Word application. You can share your entire C# code for us to troubleshoot. If the result of VBA macro is correct, there may be something wrong in your C# code.

word count microsoft word

If the issue is not related to special documents, you can also test with VBA macro below in your Word.

word count microsoft word

You can create a blank new document to test. Which version of Word application are you using?ĭoes this issue happen with all the Word documents? I suggest you testing more different documents to see whether the issue is related to special document. method both works well to calculate the page number no matter testing with C# code or VBA macro. After testing in my Word 2013, the Document.ComputeStatistics method and









Word count microsoft word