Too wide left margin prevents text to fit to window

Hi there, my Richtextboxes look like this: how can I set the left margin? 



3 Replies

KG Kalaivannan Ganesan Syncfusion Team June 27, 2023 09:38 AM UTC

To set the page margins in a document, you can iterate through the document sections and adjust the page margins of each section's format. We have also attached the sample application to demonstrate the same.

You can modify the values of the Left, Right, Top, and Bottom properties to set the desired page margins according to your requirements.

For more information about page margins, you can refer to the API documentation using the following link:
https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Controls.RichTextBoxAdv.SectionFormat.html#Syncfusion_Windows_Controls_RichTextBoxAdv_SectionFormat_PageMargin


Attachment: SfRichTextBoxAdv_PageMargins_4ed23663.zip


GG Gyorgy Gorog June 27, 2023 02:10 PM UTC

Thanks, Kalaivannan, that's just perfect. I my hands it looks like this:

private void AdjustMargins( SfRichTextBoxAdv richTextBoxAdv ) {


if ( richTextBoxAdv.Document is null ) return;

if ( !richTextBoxAdv.Document.Sections.Any() ) return;


for ( int i = 0; i < richTextBoxAdv.Document.Sections.Count; i++ ) {

SectionAdv section = richTextBoxAdv.Document.Sections[i];

section.SectionFormat.PageMargin = new Thickness( 0, 0, richTextBoxAdv.Width / 10, 0 );

}

}




KG Kalaivannan Ganesan Syncfusion Team June 28, 2023 05:43 AM UTC

Thank you for your feedback. We are glad to hear that the solution provided worked well for you.


Loader.
Up arrow icon