We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Calculating Linespacing

hi,

how can i calculate the linespacing for multiple textlines to fit in a fixed textbox.

For expample:

Font=Verdana, Size=12pt, Style=Regular

I have 3 textlines with this font and a fixed textbox-height of 180 pixels. So i want to fit the 3 textlines exactly in this textbox w/o any inner-margins.

i try to calculate Ascent and Descent of that font but it does not fit, whats wrong?

Can i get a c# sample how to do this?

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

Thanks for your inquiry. Could you please attach your documents (template and output document) for reviewing? Also please create the document that will show me how the output document should look like and attach in here. And last thing please provide me your code.

I will investigate the problem and try to help you.

Best regards

hi,

here is my sample.zip including source-xml, sample-code with produced-word-file and a word-file of how it should be!

Background Information: we must converting articles pixel-exact from xml to word-format. The psp.xml contains a pressreview of an article converting to word-doc. But the problem are the linespacings of word.

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

Thank you for additional information. By default line spacing is 12 points. In your case line spacing is deviated between 1.2*12 to 0.8*12. Unfortunately I have no idea how to calculate exact value of LineSpaceing in this case:

As I can see the following code double ls = asc + desc; always returns the same value as f.GetHeight(g).

So you have LineSpacing = Font.Size.

Best regards.