How can I control individual page orientation when converting Excel documents to XOD?

46 views
Skip to first unread message

Aaron

unread,
Jul 30, 2014, 6:14:16 PM7/30/14
to pdfne...@googlegroups.com
Q: we have noticed all excel sheets are shown in portrait layout, and we would like to have as default a portrait layout. Ho can we do that?

-----
A:

The conversion should preserve the page orientation of the input document.  If this is not the case, please provide steps to reproduce the behaviour (we would need a sample document and information about the version of Word you're using as well as the Windows version and architecture you're running on).

The Conversion API does not provide options to change orientation.  But there are ways to programmatically change the orientation of a page.

It might be easiest to programmatically change your Excel documents to your desired orientation.  For this you would need to use Office development tools (http://support.microsoft.com/kb/219151, http://msdn.microsoft.com/en-US/office/aa905340).

Another option would be to rotate the page of the XOD file after conversion, which can be done through an XPS editing API (such as http://msdn.microsoft.com/en-us/library/windows/desktop/dd316976%28v=vs.85%29.aspx) .

A third option would be to use the PDFNet SDK, which provides the capability to rotate PDF pages.  So if you were to first convert your office document to PDF, then to XOD, you could rotate the PDF page prior to converting it to XOD.  You can detect a page's current orientation with Page.GetPageWidth() and Page.GetPageHeight():

http://www.pdftron.com/pdfnet/PDFNet/html/M_pdftron_PDF_Page_GetPageWidth.htm
http://www.pdftron.com/pdfnet/PDFNet/html/M_pdftron_PDF_Page_GetPageHeight.htm

If Page.GetPageWidth() > Page.GetPageHeight(), the page is currently in landscape mode.  Otherwise, it's currently in portrait mode.

You can rotate a PDF page with Page.SetRotation():

http://www.pdftron.com/pdfnet/PDFNet/html/M_pdftron_PDF_Page_SetRotation.htm.
Reply all
Reply to author
Forward
0 new messages