Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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

These columns can be created using the methods provided by the SectionColumns interface, accessible by 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);