Free Support Forum - aspose.com

Losing Font Format

hi all...

i have this problem: I create a Document via a word template that have a font size and a font type fixed in dot file.

whene I opening a document (via word template) and save it, the font size and font type in the doc file created by dot file was changed always in Times New Roman (12pt). Why?

In my dot file the size is 10pt and the type is Tahoma...why when I create a document by dot template, it's change the font type and size?

this is my code:

Document allOrdersDoc;

Document oneOrderDoc;

allOrdersDoc = new Document();

allOrdersDoc.RemoveAllChildren();

for(int x = 0; x < rows; x++){

oneOrderDoc = new Document(Server.MapPath("Dot/Report.dot"));

int pickOrderId = int.Parse(dt.Rows[x].ItemArray.GetValue(0).ToString());

object[] parameters = {pickOrderId};

DataTable dtRow = SqlHelper.ExecuteDataset(cn, "SelectPickOrderLineByPickOrder_Cs", parameters).Tables[0];

dtRow.TableName = "PickOrderLine";

oneOrderDoc.MailMerge.ExecuteWithRegions(dtRow);

oneOrderDoc.MailMerge.Execute(dt.Rows[x]);

AppendDoc(allOrdersDoc, oneOrderDoc);

}

string path = Server.MapPath("Dot/Ordini.doc");

=============================================

private void AppendDoc(Document dstDoc, Document srcDoc) {

for(int x = 0; x < srcDoc.Sections.Count; x++) {

Aspose.Word.Section section = (Aspose.Word.Section)dstDoc.ImportNode(srcDoc.Sections[x], true);

dstDoc.Sections.Add(section);

}

}

===============================================

thanks!!!

BYE!

Try using ImportNode with ImportFormatMode set to KeepSourceFormatting.

thanks for reply, but I don't have the overload for ImportNode to use ImportFormatMode...do you have another way?

Thanks...

Crying [:'(]Zip it! [:#]

What version of Aspose.Word do you have? If you have purchased Aspose.Word less than a year ago, you can freely upgrade to the latest version, which is currently 3.3.3.0.