PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Paragraph margins and padding https://forum.pdfsharp.net/viewtopic.php?f=2&t=2111 |
Page 1 of 1 |
Author: | Basille [ Tue Aug 21, 2012 9:53 am ] |
Post subject: | Paragraph margins and padding |
A question from a newbie: How do I set margins and padding for a Paragraph? As I can see the class itself does not provide methods for it. Any hint is appreciated, thank you! |
Author: | Thomas Hoevel [ Tue Aug 21, 2012 12:37 pm ] |
Post subject: | Re: Paragraph margins and padding |
Hi! Basille wrote: How do I set margins and padding for a Paragraph? Try paragraph.Format and look for LeftIndent, RightIndent, FirstLineIndent, SpaceBefore, and SpaceAfter.You can create a Style with your settings and just assign the style to the paragraph. |
Author: | Basille [ Tue Aug 21, 2012 2:25 pm ] |
Post subject: | Re: Paragraph margins and padding |
Hi Thomas and thanks for the response. Is it possible to style a specific paragraph? So far I only saw the means to address all paragraphs. |
Author: | Thomas Hoevel [ Tue Aug 21, 2012 2:53 pm ] |
Post subject: | Re: Paragraph margins and padding |
Hi! Basille wrote: Is it possible to style a specific paragraph? Yes, check this sample:http://www.pdfsharp.net/wiki/HelloMigra ... Redirect=1 Look at DefineCover and DefineTableOfContents. There's no way to change all paragraphs in a document. You can only change all paragraphs that use the same style by changing that style. You can add styles when you need more styles. |
Author: | Basille [ Wed Aug 22, 2012 5:31 am ] |
Post subject: | Re: Paragraph margins and padding |
OK, I will try that. Thank you! |
Author: | iluvathar [ Mon Feb 24, 2020 10:54 am ] | ||
Post subject: | Re: Paragraph margins and padding | ||
Ok, I scrapped together a page. This is computer generated with numerous different types of results, here are just a few. Until now I was using pdfsharp successfully. Now I wanted to switch to migradoc to reduce my code. The bits on the picture marked yellow are paragraphs. Now for the second yellow paragraph I have set the option .keeptogether, and on the table before I set .stickwithnext. But would prefer to leave out the .stickwithnext on the table, and have an option one the paragraph, .leaveOutIfFirst. All objects could have that. I have a couple of other problems if anyone can help. I have a big problem calculating width of the empty cells left and right of the table. Here is my calculation: left_right_cell_width = (myDoc.DefaultPageSetup.PageWidth.Point - mySect.PageSetup.LeftMargin.Point - mySect.PageSetup.RightMargin.Point + myDoc.Styles("Normal").ParagraphFormat.Borders.DistanceFromLeft.Point + myDoc.Styles("Normal").ParagraphFormat.Borders.DistanceFromRight.Point - myDoc.Styles("Normal").ParagraphFormat.LeftIndent.Point + 0.28 - tableWidth) / 2 Now what am I doing wrong? As you see I had to add 0.28 points so that it works correct?
|
Author: | iluvathar [ Thu Feb 27, 2020 10:35 am ] |
Post subject: | How to measure distance from paragraph left border to right? |
(myDoc.DefaultPageSetup.PageWidth.Point - mySect.PageSetup.LeftMargin.Point - mySect.PageSetup.RightMargin.Point + myDoc.Styles("Normal").ParagraphFormat.Borders.DistanceFromLeft.Point + myDoc.Styles("Normal").ParagraphFormat.Borders.DistanceFromRight.Point - myDoc.Styles("Normal").ParagraphFormat.LeftIndent.Point ) Is the above formula correct? Because I get an error about 0.28 points when I try to align it with my table. I posted an example in another threat, but wanted to make it clearer. |
Author: | Thomas Hoevel [ Thu Feb 27, 2020 2:33 pm ] |
Post subject: | Re: How to measure distance from paragraph left border to ri |
iluvathar wrote: Because I get an error about 0.28 points when I try to align it with my table. Error?By default text in tables aligns with text outside tables. To achieve that, tables are by default indented a little bit to the left. |
Author: | iluvathar [ Fri Feb 28, 2020 9:51 am ] |
Post subject: | Re: Paragraph margins and padding |
I get this, but how do I align paragraph lines with table lines. In the example I had to add 0.28 points to calculation. So I can get the width of empty table cells on left right. However tables are dynamically generated, therefore they can have wider column and more column. I am worried that my line will in some cases skip one point and not be align to paragraph border. So is my 0.28 point correct? I hope this makes sense. Quote: To achieve that, tables are by default indented a little bit to the left. So I should use that in my calculation also? I made the formula mentioned before and I want to change it so it is correct, can you/anyone help? I have my primary table width, now I have to calculate left and right column, so I get the lines aligned. |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |