View previous topic :: View next topic |
Author |
Message |
rb7smutje
Joined: 09 Apr 2008 Posts: 2
|
Posted: 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! |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: 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 ... _________________ Regards
Thomas Hoevel
PDFsharp Team |
|
Back to top |
|
|
rb7smutje
Joined: 09 Apr 2008 Posts: 2
|
Posted: 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! |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: 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 ... _________________ Regards
Thomas Hoevel
PDFsharp Team |
|
Back to top |
|
|
PeterMueller
Joined: 04 Dec 2008 Posts: 4
|
Posted: 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! |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: 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. _________________ Regards
Thomas Hoevel
PDFsharp Team |
|
Back to top |
|
|
PeterMueller
Joined: 04 Dec 2008 Posts: 4
|
Posted: 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). |
|
Back to top |
|
|
Thomas Hoevel
Joined: 16 Oct 2006 Posts: 387 Location: Cologne, Germany
|
Posted: 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;
|
_________________ Regards
Thomas Hoevel
PDFsharp Team |
|
Back to top |
|
|
PeterMueller
Joined: 04 Dec 2008 Posts: 4
|
Posted: Thu Dec 04, 2008 4:00 pm Post subject: |
|
|
Thank you very much, keep up the great work and greetings to the Domstadt! |
|
Back to top |
|
|
|