Free Support Forum - aspose.com

Copying PageSetup LineNumber styles from input docx to output docx adds line numbers when viewed in Open Office Writer

The attached project reproduces an issue where for an input docx, when copying PageSetup line number information from a source section to a destination section, the resulting output docx has line numbers, numbered by 5’s, outside the margins of the document when viewed in Open Office Writer, which the input document does not have.

Specifically causing the problem are:
Snippet

destSection.PageSetup.LineNumberCountBy = sourceSection.PageSetup.LineNumberCountBy;
destSection.PageSetup.LineNumberDistanceFromText = sourceSection.PageSetup.LineNumberDistanceFromText;
destSection.PageSetup.LineNumberRestartMode = sourceSection.PageSetup.LineNumberRestartMode;
destSection.PageSetup.LineStartingNumber = sourceSection.PageSetup.LineStartingNumber;

Kyle Millns
kyle.millns@savogroup.com
Product Developer
SAVO

Hi Kyle,

Thanks for your inquiry.

I have managed to reproduce the issue on my side. This issue has been logged and will be fixed in a future version. We will keep you informed.

For now I would suggest reworking your code a little to make things simplier and to avoid this issue. Instead of copying the page setup from section to section I suggest instead:

  1. Cloning the "source" section containing the page setup settings you want to preserve.
  2. Remove all content from this cloned section.
  3. Use NodeImporter to copy all content from the source section to this section.

This should achieve what you were doing before and preserve any page setup settings for the sections.

If there are any issues please feel free to ask.

Thanks,