PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

MigraDocLite and Subscript
https://forum.pdfsharp.net/viewtopic.php?f=2&t=367
Page 1 of 1

Author:  rb7smutje [ Thu Apr 10, 2008 12:24 am ]
Post subject:  MigraDocLite and Subscript

Is there any way to format text in subscript with MigraDocLite?

For example:
Code:
paragr.AddFormattedText("irgendwas", TextFormat.Bold);

This methode doesn't offer subscript.

But I found this methode for example:
Code:
FormattedText ftext = new FormattedText();
ftext.Subscript = true;

But I don't know how to us this method in a Paragraph. How can I call this?

Anyone knows the trick or has any Idea?



Thanks a lot for this really good project!

Author:  Thomas Hoevel [ Thu Apr 10, 2008 8:35 am ]
Post subject: 

Hello!

You can't always get what you want ...
... but you get what you need ...

All the AddXXX methods return the newly added object and thus allow further modifications:
Code:
FormattedText ftext = paragr.AddFormattedText("irgendwas", TextFormat.Bold);
ftext.Subscript = true;

This trick works with paragraphs, formatted text, textframes, rows, columns, ...
Otherwise there would have to be lots of overloaded AddXXX methods with lots of different parameter sets ...

Author:  rb7smutje [ Thu Apr 10, 2008 9:46 pm ]
Post subject: 

If thought the text was this:
...you don't get what you need...

But here it is opposite.

Thank you very much!
Great work.


Regards!

Author:  Thomas Hoevel [ Mon Apr 14, 2008 9:01 am ]
Post subject: 

rb7smutje wrote:
If thought the text was this:
...you don't get what you need...

I had an old Rolling Stones song on my mind ... :wink:

Author:  PeterMueller [ Thu Dec 04, 2008 11:30 am ]
Post subject: 

Hello,

I want to use subscript in a cell of a table.

Thomas Hoevel wrote:
... All the AddXXX methods return the newly added object and thus allow further modifications:
Code:
FormattedText ftext = paragr.AddFormattedText("irgendwas", TextFormat.Bold);
ftext.Subscript = true;

This trick works with paragraphs, formatted text, textframes, rows, columns, ...


I tried it this way:
Code:
FormattedText ftext = cell.AddFormattedText("x1", TextFormat.Bold);
ftext.Subscript = true;

Unfortunately the Compiler complains "'MigraDoc.DocumentObjectModel.Tables.Cell' enthält keine Definition für 'AddFormattedText'." (= "'MigraDoc.DocumentObjectModel.Tables.Cell' does not contain a definition for 'AddFormattedText'.") Is there any workaround for my problem? Any help is welcome!

Author:  Thomas Hoevel [ Thu Dec 04, 2008 12:04 pm ]
Post subject: 

First add a paragraph to the cell:
Code:
Paragraph paragraph = cell.AddParagraph()


Then add the formatted text to that paragraph.

Author:  PeterMueller [ Thu Dec 04, 2008 1:12 pm ]
Post subject: 

Thanks a lot! Is it possible to avoid the linebreak? I want to write "lx1" in the cell of a table, "x1" as subsript.

By writing the following
Code:
cell.AddParagraph("l");
Paragraph paragraph = cell.AddParagraph();
FormattedText ftext = paragraph.AddFormattedText("x1", TextFormat.Bold);
ftext.Subscript = true;


the result is:
"l"
"x1" (with a linebreak).

Author:  Thomas Hoevel [ Thu Dec 04, 2008 2:48 pm ]
Post subject: 

Yep:
Code:
Paragraph paragraph = cell.AddParagraph("l");
FormattedText ftext = paragraph.AddFormattedText("x1", TextFormat.Bold);
ftext.Subscript = true;

Author:  PeterMueller [ Thu Dec 04, 2008 4:00 pm ]
Post subject: 

Thank you very much, keep up the great work and greetings to the Domstadt!

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/