Free Support Forum -

Output formatting questions

hello, i have a couple questions about formatting with aspose.word (and html <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

and pdf)

the first question is about the latest version of aspose compared to an

older version i worked with.

Report-old.doc is a document i created with a version of aspose from

10/29/2004. i took lots of time making the spacing, and formatting be

exactly what i wanted. Report-latest.doc is a document created with the

exact same code, but with the latest version of aspose installed. it is

quite different. with the most obvious difference being the line spacing.

did something change on purpose in the new version? (how write() and

writeln() are handled?) or have i found some sort of bug? is there any way

i can get my report to look like it did with the old version without going

back to all 65 controls (each "chart" or "paragraph" is a seperate control)

and reformatting them to look like i want with the new version of aspose?

(and should i expect to have to reformat my reports each time i upgrade to a

new version of aspose?)

the second question is about doc formatting comapred to html and pdf.

Report-latest.doc, Report-latest.htm and Report-latest.pdf are all reports

generated with the same code, with only the destination format changing.

Report-latest.doc is what i want the report to look like. (apart from the line spacing problems i mentioned in the first question) Report-latest.htm is quite different. the most glaring differences being the lack of cell shading in the tables, and the fact that the table cell widths aren't correct. look at the charts in the "California Standards Tests (CST)"

section. you can see that the columns don't like up well at all. i

formatted the cells in the .doc file by setting the widths in pixels. some are down to hundredths of pixels. ie:

builder.CellFormat.Width = 1.28 * 72;

and i set the shading for the cells like this:

builder.CellFormat.Shading.Texture = TextureIndex.Texture25Percent;

is there something about the methods i'm using that would make the html charts not line up? and make the table cell shading not show up in html?

Report-latest.pdf is also different. the most obvious, again, being the shading. the columns in the tables seem to align correctly for the pdf version.

if you know of something i can do to get the reports to look the same (i know they won't be exact, but they have to be closer than they are now)

please let me know.

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

I'm not exactly sure how you produce the documents and what caused the changes. One thing we've been working on extensively is HTML import module and if you import HTML, our changes could have affected your outputs.

The goal of our HTML import was always try to make it work as close as possible to what MS Word does when importing HTML documents. We've added some features and revised some, but I don't think it should have resulted in this big difference in the way empty paragraphs are inserted (unless you do something very special).

If you let me know how you create the documents and send me a sample of your template report, I might be able to find a solution to get your outputs back into shape without much rework from your side.

Maybe you create the whole report in code using DocumentBuilder, without using any template document? I'd say it's a tough way to have whole report hardcoded. I would try to keep as much of the report content as possible in template document(s) and then use mail merge, DocumentBuilder and Sections to populate and combine documents if needed to form a complete report. Please see the latest demo project source code included in the product installer, for example for to create a Product Catalog.

To answer your second question, Aspose.Pdf does not support cell shading, it only supports solid cell color. I also think that there is no shading available in HTML and maybe even in CSS so only solid colors are supported.

The fact that cells are not aligned vertically in HTML is due to very different border space allocation systems between CSS and Word. We are still investigating this problem and will try out best so the borders align well.

I've also noticed that merged cells in your DOC do not output correctly (outputs more cells) to HTML and PDF, we will try to fix this asap.

yes, i did do the entire report with the DocumentBuilder object. mostly because the reports are too dynamic for "templates" since the columns and titles and just about everything about them changes.

i did figure out what the biggest "change" was. in MANY places, in order to cause a carriage return, or to make extra line feeds, i used this bit of code:


in the latest version, this seems to be ignored. i guess the engine thinks there is nothing to do, so it does nothing. all i did to get back 99% of my formatting was change those lines to this:

builder.Writeln(" ");

now that it has a "space" character to output, the engine does what i want it to and makes a carriage return. having the extra spaces isn't prefect, but it's better than not having the cariage returns. is there another (better?) way to make marriage returns?


Try builder.InsertParagraph();

Writeln() could have changed to ignore empty strings. Sorry if I missed that. We will rething, it probably should output one empty paragraph for an empty string, this will be more correct than do nothing.