Font/Size Changing Issue - Revisited


#1

Hi,

The company that I work for just recently purchased the developer version of Aspose.Word based on my say so, even though I had problems with some font/size issues with the trial version. So I am desperately looking for answers/ideas as to what I’m doing wrong or how I can work around my problem.

The problem is that the bookmarked fields and non-fillin and non-merge fields (System fields accessed from Insert>Field…> menu such as DateTime fields) are not keeping their format (existing in the template) when being programmatically filled.

Here’s a code snippet of what I’m doing:

//designer variables
FileStream fs = new FileStream(filename, FileMode.Open);
Aspose.Word.Document doc = new Aspose.Word.Document(fs);

void FillData()
{
object oBookmark = “Additional”;
doc.Range.Bookmarks[oBookmark.ToString()].Text=“SOME TEXT HERE”
}

This is essentiall all I am doing, although simplified quite a bit because I am using arraylists for bookmarks and data.

I really don’t think I am doing anything special. Most of the body of the document, the bookmarked fields are Tahoma 11pt. In the top header we have Tahoma 8pt size. If I were to change the font size of the first charater in the document represented by the OLogo bookmark to say 14pt, the generated document will have all the aforementioned bookmark fields become 14pt. I have included the Aspose.Word generated document in this post and will include the orginal document template document in a following post.

I hope you can shed some light to my situation and look forward to your prompt response. Thank you.

Paulo Fuh
ORTICON
pfuh@ortc.com


#2

Hi Again,

As promised I’ve attached the original template file that generated the above output.

Thanks again.

Paulo Fuh
ORTICON
pfuh@ortc.com


#3

Hi Paulo,

Are you using the latest version of Aspose.Word? There were some bookmark font size fixes in 2.2.5:

http://www.aspose.com/blogs/Roman.Korchagin/


#4

Thanks Dimitry,

Initial tests look very promising. Will let you know if any other issues arise. Thanks very much.

Paulo Fuh
ORTICON
pfuh@ortc.com


#5

Hi Again,

Almost there. I am still having some issues with font/size issue in some documents. I particularly notice the problem is when a particular bookmark is say 8pt (see header) and the next character, whether it’s an end-of-cell or new paragraph character, is set to a font of size 11pt, the resulting bookmark will be programmatically filled with the 11pt size which is not what I wanted.

It is an easy fix for one document or two. But I may have to change this on 500+ documents.

I hope you guys can come up with another update that will solve this problem. You haven’t let me down yet.

Look forward to your expedient responses.

Thank you.

Paulo Fuh
ORTICON
PS I attached a new generated document and will post the original template too.


#6

As promised, here’s the original template referenced in the previous post.


#7

This issue will likely to be fixed in the next hotfix in 2-3 days.


#8

Hi,

Aspose.Word 2.2.6 is released. Fixed losing font formatting after changing bookmark text.

http://www.aspose.com/blogs/Roman.Korchagin/

Thank you for your interest in Aspose products.