Free Support Forum - aspose.com

Font problems when merging documents

Hi guys,

I’m currently upgrading to version 3.0.1.0 of Aspose.Word and have come across a font problem.

When I merge documents some of the documents get the default font of the first document which is coversheet generated on the fly. I remember going though pains with templates to get this working on the previous versions. Also I’m finding the export to PDF the fonts problems seem to get worse again the default font of the coversheet appear all over the place.

I had attach some files demostrating the problem. The winrar file contains two winrar file one with an example project showing an example of source code and the second with the dodgy Word and PDF, and what we get from our current live version (2.4.1.0) indicated by the *- live.doc

The only changes I had to make to upgrade was this change:

public static Aspose.Word.Document Merge(Aspose.Word.Document destination, Aspose.Word.Document source)

{

// while (source.Sections.Count > 0)

// {

// Section section = source.Sections[0];

// source.Sections.RemoveAt(0);

// destination.Sections.Add(section);

// }

foreach(Section sourceSection in source.Sections){

Section newSection = (Section) destination.ImportNode(sourceSection, true);

destination.Sections.Add(newSection);

}

source = null;

return destination;

}

I hope this helps you replicate the problem.

Regards

Toby


Hi Toby,

Thank you for considering Aspose.

Please check back in few days, we will investigate the issue.

Hi guys,

Just wondering if you have an update, boss is bugging me.
Is this problem related to the other style issues showing up in the forums ?

Toby

Hi Toby,

You have quite a few documents there and some are about 130 pages long. Please specify exactly document name, what page and where on the page you have the problem you are talking about.

Hi Roman,

In the document “MICROSOFT 10-K 01-Sep-04.doc” the first page text is Verdana. The font goes strange on page 66 and becomes Courier New until page 124.

The Problem documents seem to be these ones, if you open them in word the font is New Times, but when you put the coversheet on it, it changes to Courier New.

“e3a14de5-ab9a-475d-9794-dfd94ed349d7.doc”,
“aac04150-f6d6-4be6-9568-1859ff5f6d9c.doc”,
“46e70cd4-d4df-483e-ad58-2465740b504c.doc”,
“a3b9f28c-9033-4853-9faf-6dffeb68d20f.doc”,
“9928fdcb-daba-43b5-9668-7811c2a28e2a.doc”,
“e9bb8114-56da-4acf-92d3-b0b431f54d6d.doc”,
“2d99cd5b-9763-4941-b697-ed76a2d012f3.doc”,
“3e22d1ff-48aa-4a8c-9e13-a5f24e0fa6ac.doc”,
“9847c94a-200e-4a07-8a40-b374d41e0cea.doc”,
“335d7d69-acdd-4bc8-abec-2b769c98d37c.doc”,
"9571091e-ad26-4fe1-8b53-94895e42669f.doc"

Also if you look at “MICROSOFT 10-K 01-Sep-04.pdf” you’ll see that Courier New appears on different lines through out the document. Not sure if this is due to the word export or the PDF import .

Regards

Toby

There are two distinct issues here:

1. “Random” loss of font formatting fixed in Aspose.Word 3.0.3. That was caused by Aspose.Word and Aspose.Pdf not always agreeing on the way to treat the text segments. Basically all was okay in the DOC file, the problem was in the PDF export.

2. Courier New font that appears from page 66 to page 124 - this happens after the DOC files are merged into a single DOC file. This is not an export problem, this effect is caused by different styles in the different documents. This is my write up on this question https://forum.aspose.com/t/127601
To solve this one, Dmitry suggested you modify the Normal style in the destination document so it is not using Courier New.


Thanks Roman

Sorry I had a few days off.

1) I tried this with your lastest release 3.1 and all seems fine. Thanks

2) I’ve read your post and see what the problem is. I will post my thoughts to that thread.

and will go with Dmitry’s idea


Thanks again guys !