Can you let us know how to set page width and height as per contents available, using aspose words?
Documents are attached.
Thanks for your query. Please use the following code snippet for your requirement.
Please read documentation of PageSetup class. PageSetup object contains all the page setup attributes of a section (left margin, bottom margin, paper size, and so on) as properties.
Document doc = new
Document();<?xml:namespace prefix = o ns = “urn:schemas-microsoft-com:office:office” /><o:p></o:p>
section in doc.Sections)<o:p></o:p>
section.PageSetup.PageHeight = 100;<o:p></o:p>
section.PageSetup.PageWidth = 100;<o:p></o:p>
doc.Save(MyDir + “AsposeOut.docx”);<o:p></o:p>
Please let us know if you have any more queries.v
No. I do not want to set any fixed height , width. I want to resize page as per content available . The contents can be less or more and the code should calculate the required height and width. Let us know how to calculate using aspose words Java.
Thanks for your query. Aspose.Words mimics the same behavior as MS Word do. I would like to share with you that MS Word document is flow document. It means that it does not contain any information about its layout into lines and pages. So there is no way to get the height of contents in a page.
Please let us know if you have any more queries.