Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I just wanted to ask questions to understand how much space is available in the word document last page after  last paragraph. If the page is less than half full I will add a table otherwise I will not add (I will use Page Break code then add table to add another page). How to find page line position of last paragraph in openXml?


What I have tried:

I tried solving it using C # but I couldn't solve it. I don't think there are enough solution sources.
Posted
Updated 4-Mar-20 22:01pm
v3

1 solution

It is never a simple matter to calculate free space in a word document, because there are so many variables. Starting with page size you need to know the height and width. Next reduce that by the four margins (which may all be different values). You then need to work through all the content of the file calculating the space used by each part, taking account of inserted page breaks, orphan controls etc.
 
Share this answer
 
Comments
Member 4675946 6-Mar-20 8:38am    
Thank you for your important information Richard MacCutchan. Is there any resolved code related to this problem to date? If yes, can you share the source code?

Thanks.
Richard MacCutchan 6-Mar-20 9:32am    
Sorry, I have no idea, try Google.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900