PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon May 06, 2024 1:43 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Thu Apr 10, 2008 12:24 am 
Offline

Joined: Wed Apr 09, 2008 11:55 pm
Posts: 2
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!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 10, 2008 8:35 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Apr 10, 2008 9:46 pm 
Offline

Joined: Wed Apr 09, 2008 11:55 pm
Posts: 2
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!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Apr 14, 2008 9:01 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
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:

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 04, 2008 11:30 am 
Offline

Joined: Thu Dec 04, 2008 11:14 am
Posts: 4
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!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 04, 2008 12:04 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
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


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 04, 2008 1:12 pm 
Offline

Joined: Thu Dec 04, 2008 11:14 am
Posts: 4
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).


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 04, 2008 2:48 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3097
Location: Cologne, Germany
Yep:
Code:
Paragraph paragraph = cell.AddParagraph("l");
FormattedText ftext = paragraph.AddFormattedText("x1", TextFormat.Bold);
ftext.Subscript = true;

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 04, 2008 4:00 pm 
Offline

Joined: Thu Dec 04, 2008 11:14 am
Posts: 4
Thank you very much, keep up the great work and greetings to the Domstadt!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 68 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group