Free Support Forum - aspose.com

Append documents changes format

Hi When I append two documents using the following statements the text format (line breaks are different) in the part that was appended compared to it's original.

Aspose.Words.Document doc = new Aspose.Words.Document(@"c:\Welcome Letter Rontest.DOT")
doc.AppendDocument(@"c:\Alabamarontest.dot", ImportFormatMode.KeepSourceFormatting);
doc.UpdateFields();
doc.UpdatePageLayout();
doc.Save(sFileToSave, SaveFormat.Doc);

sFileToSave has the value 634130773888497484Welcome Letter1.Doc

Can you please help me figuring out what causes the different layouts. I've attached all relevant documents.

Regards,

Ron


Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. AS I can see, the only difference is that one paragraph break on the first page of the appended document is moved to the previous page. This occurs because Continuous section break is used. If you modify your code, like shown below even this difference disappears:

Document dst = new Document(@"Test001\Welcome+Letter+Rontest.DOT");

Document src = new Document(@"Test001\Alabamarontest.dot");

src.FirstSection.PageSetup.SectionStart = SectionStart.NewPage;

dst.AppendDocument(src, ImportFormatMode.KeepSourceFormatting);

dst.UpdateFields();

dst.UpdatePageLayout();

dst.Save(@"Test001\out.doc", SaveFormat.Doc);

Please correct me if I am wrong.

Best regards.

Hi,

The solution you provided me worked on the AlabamaRontest doc I sent to you. However original document is much larger and contains one more section break (next page) If you look at this document and compare it with it's original template you'll notice the folLowing:

  1. Many line breaks are different
  2. The tab settings are different
  3. In one occasion the bottom marging seems different (page 9)

I've highlighted the places where I discoved differences.

Attached you'll find the complete version of the AlabamaRontes.dot document plus the result document after the append. I included the suggested code from 06-26-2010 in my program.

Hopefully you can help us further with this issue.

Thanks,
Ron

Hi Ron,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I suppose all of these problems are related to the issue with TabStops. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

Best regards,

Hi Alexey,
I agree 95% of all the line breaks are caused by the missing tab. However there are also some breaks on lines that does not have a tab in the template document. for example the last line on page 9 of the marked document I attached yesterday has no tab at all.

I don't know what the schedule is of solving issues like this but all and all it'bringing me into trouble because every type of document (besides a single document) we create and save to Word or PDF look very dissapointing. Here is the comment from my customer (he copied his CEO in as well):

Make sure they understand they have us at a stand still. We can test the schedule page<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

(page 3) but not the rest of the policy due to the shifting. We cannot take anything to

production until we know the original document is not being altered from the way it was

filed.

Can you give me any idea when you think this will be solved?

Please give this Issue the appropriate priority,

Thanks,

Ron

Hi Ron,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I managed to reproduce the problem with line break on the page 9. Your request has been linked to the appropriate, you will be notified as soon as it is fixed.

It is difficult to provide you any reliable estimate at the moment. We will be sure to inform you of any developments regarding these issues.

Best regards,

Hi,

My customer is getting very frustrated and is running out of patience because I can't give them a time estimate when this issue will be resolved. Bassically I can't blame them and I feel the same.

I already upgraded my support to priority support in the hope things are moving a little faster. How can we do Business when we don't get an SLA from Aspose regarding software bugs.

Please provide me with an e-mail address or channel to someone higher up in the support organization so I can escalate my open issues.

Thanks in advance,

Ron van Leeuwen

Hi Ron,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I raised priority of the issue. We will keep you informed on any developments regarding this issue.

Best regards,

Hi Ron,

We had a look at your documents and at the issue 18118 where part of content moves to the previous page.

The problem is caused by the fact that the source and destination documents have different values of one obscure MS Word Compatibility Option. The name of the option is "Suppress extra line spacing the way WordPerfect 5.x does".

Basically in your source document this option is turned OFF. Which seems to be the default value.

But in your destination document this option is turned ON.

The effect of this option appears to be this "strange" behavior (well, it was probably "smart behavior of WordPerfect" in its days). It appears like if there is one line does not fit onto the page - WordPerfect would reduce spacing a little bit to fit the line it. When this option is turned on in MS Word - it does the same - reduces the spacing.

As you can see - when you append one document to another (or copy nodes from one document to another for that matter) - only the nodes and their related styles and formatting is copied by Aspose.Words. I do not see a way how we can fix this issue in Aspose.Words - I do not think Aspose.Words should copy document compatibility options. I do not see any meaningful way of doing this.

What you need to do is to switch OFF this option in the destination document. Either in MS Word or programmatically using Aspose.Words see http://www.aspose.com/documentation/.net-components/aspose.words-for-.net/aspose.words.settings.compatibilityoptions.suppresstopspacingwp.html

I am closing this issue as "Not a Bug".

Hi Ron,

There is a similar issue with 18104 where tab stops appear to be lost. There is nothing lost I checked.

The difference is only in display because the destination document has the MS Word Compatibility Option Use Printer Metrics to Layout Document set to ON whereas the source document has it OFF (default for MS Word).

I think some of your documents were created either using WordPerfect because they have a lot of compatibility options set and MS Word shows the profile of the options as "Custom". There is not much we can do in Aspose.Words to help you. You need to figure out a way to make sure your documents do not have such "incompatible" compatibility options.

I am sure you would see the same problems even if you just copied and pasted text inside Microsoft Word. It is not reasonable to expect that Aspose.Words can provide a solution in this case.

I am closing as "Not a Bug".

If you need more help, let us know. Our support could help you to code a workaround that will reset compatibility settings programmatically.

Hi Roman,

Thanks for the effort Aspose put into these Issues. I Don't want to reset the compatibility settings. This is the responsibility of my customers. They need to clean up their Templates. As you already mentioned these settings where copied over a long time ago when my customer migrated from WP to Word.

Regards,

Ron