I need to change MS Word document's page size from Letter to A4 and found this automation class: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.document_members.aspx. Which property (possibly a nested one) do I need to set? I can't find anything related to page size.
相关问题
- How do I restart a COM+ application on a remote se
- Converting byte array output into Blob corrupts fi
- Java COM bridge
- Powershell - add catch to pick up if there are no
- docx4j - delete wml P element
相关文章
- System.Runtime.InteropServices.COMException (0x800
- Signing an F# Assembly (Strong name component)
- Python instrument drivers
- How to print a docx to a specific printer using Mi
- How To Programmatically Enable/Disable 'Displa
- Open file from windows file dialog with python aut
- Deleting columns from a table with merged cells
- Reading data from Excel in Haskell
Based on the documentation you reference it is seen that a
Document
exposes aPageSetup
property.The
PageSetup
property has aPaperSize
property which allow you to define the paper size of the document - the complete list of available paper sizes is specified by theWdPaperSize
enum ( see its members here: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.wdpapersize.aspx ).So basically, to set the paper size of a document you can do something like this:
To show how this can be done in a "complete" context, I have included a complete sample in the following. The sample is implemented as a C# console application using .NET 4.5, Microsoft Office Object Library version 15.0, and Microsoft Word Object Library version 15.0 ( that is, the object libs. that ships with MS Office 2013 ).