Skip to content

DevExpress-Examples/asp-net-web-forms-richedit-page-settings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASPxRichEdit - How to define default page settings such as margins, paper kind, etc.

This example demonstrates how to set a document page's landscape, paper kind, margins, and font properties.

Implementation Details

The non-visual RichEditDocumentServer component allows you to adjust document settings. Create a new document and adjust its page by using the corresponding API.

private void NewDocument() {
    RichEditDocumentServer server = new RichEditDocumentServer();
    server.Document.Sections[0].Page.Landscape = false;
    server.Document.Unit = DevExpress.Office.DocumentUnit.Millimeter;
    server.Document.Sections[0].Margins.Left = 0.5f;
    server.Document.Sections[0].Margins.Right = 0.5f;
    server.Document.Sections[0].Margins.Top = 0.5f;
    server.Document.Sections[0].Margins.Bottom = 0.5f;

    server.Document.DefaultCharacterProperties.FontName = "Arial";
    server.Document.DefaultCharacterProperties.FontSize = 12f;
    server.Document.DefaultCharacterProperties.ForeColor = Color.Red;

    server.Document.Sections[0].Page.PaperKind = System.Drawing.Printing.PaperKind.Custom;
    server.Document.Sections[0].Page.Width = 105f;
    server.Document.Sections[0].Page.Height = 297f;

    MemoryStream memoryStream = new MemoryStream();
    server.SaveDocument(memoryStream, DocumentFormat.Rtf);
    ASPxRichEdit1.Open("document" + Guid.NewGuid().ToString(), DocumentFormat.Rtf, () => { return memoryStream.ToArray(); });
}

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Set a document page's landscape, paper kind, margins, and font properties.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •