Question

I am using Microsoft Open XML SDK to generate a word document. I have used Open XML SDK 2.0 Productivity Tool for converting the word document into C# code, and thus I have created a wrapper class by encapsulating the table creation code. I have successfully generated word document.

But the issue is, some tables are expanding in their width beyondpage margins. I searched in google, and found that GrowAutoFit class allows Tables to AutoFit into page margins, but I couldn't find the exact usage of this class to implement the functionality.

I searched a lot for many days before asking a question here, as i have read the terms of asking a question on this forum. I got tired of searching, and i'm putting forward this query here. So please suggest me the solution.

Was it helpful?

Solution

I found the answer for my own question.

The reason for the tables extending out of page was that i had set page margins as zero in the code. So, after i set the page margins as 1 inch on all sides, the tables are not extending out of margins.

Thanks to the Office Open XML SDK Productivity tool, which shows the native XML code, and also the C# code when a word document is opened in it. And becuase of this tool, i was able to figure out the issue.

Thanks for your suggestions Maximilian :)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top