This example demonstrates how to set a document page's landscape, paper kind, margins, and font properties.
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(); });
}
- Default.aspx (VB: Default.aspx)
- Default.aspx.cs (VB: Default.aspx.vb)
(you will be redirected to DevExpress.com to submit your response)