Skip to main content

How to: Create a Three-Column Layout with Uniform Columns

These columns can be created using the methods provided by the SectionColumns interface, accessible vby the Section.Columns property of the document section. First, create the required column layout. The SectionColumns.CreateUniformColumns method allows you to create a specified number of columns on a page with the required spacing. Then, the layout is applied to the document content using the SectionColumns.SetColumns method.

The following code illustrates how the above technique can be used to create three columns with 0.2 inches of distance between them. They will have the same width, calculated automatically according to the current page layout.

View Example

Document document = server.Document;
document.LoadDocument("Documents\\Grimm.docx", DevExpress.XtraRichEdit.DocumentFormat.OpenXml);
document.Unit = DevExpress.Office.DocumentUnit.Inch;
// Get the first section in a document
Section firstSection = document.Sections[0];
// Create columns and apply them to the document
SectionColumnCollection sectionColumnsLayout =
    firstSection.Columns.CreateUniformColumns(firstSection.Page, 0.2f, 3);
firstSection.Columns.SetColumns(sectionColumnsLayout);