VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Office.OpenXml.Docx Namespace / DocxPageCollection Class
Members Object Syntax Example Hierarchy Requirements SeeAlso
In This Topic
DocxPageCollection Class
In This Topic
Represents a collection of DocxPage objects.
Object Model
DocxPage DocxPageCollection
Syntax
Example

Here is an example that shows how to render all pages of DOCX document and save rendered images to PNG files:


''' <summary>
''' Renders all pages of DOCX document and saves rendered images to PNG files.
''' </summary>
''' <param name="filename">A name of DOCX file.</param>
Public Shared Sub RenderAndSaveDocxPages(filename As String)
    ' open DOCX document
    Using docxDocument As New Vintasoft.Imaging.Office.OpenXml.Docx.DocxDocument(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read)
        ' for each DOCX page
        For i As Integer = 0 To docxDocument.Pages.Count - 1
            ' render DOCX page
            Using renderedPage As Vintasoft.Imaging.VintasoftImage = docxDocument.Pages(i).Render()
                ' save rendered image to a PNG file
                renderedPage.Save(String.Format("page{0}.png", i))
            End Using
        Next
    End Using
End Sub


/// <summary>
/// Renders all pages of DOCX document and saves rendered images to PNG files.
/// </summary>
/// <param name="filename">A name of DOCX file.</param>
public static void RenderAndSaveDocxPages(string filename)
{
    // open DOCX document
    using (Vintasoft.Imaging.Office.OpenXml.Docx.DocxDocument docxDocument =
        new Vintasoft.Imaging.Office.OpenXml.Docx.DocxDocument(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read))
    {
        // for each DOCX page
        for (int i = 0; i < docxDocument.Pages.Count; i++)
        {
            // render DOCX page
            using (Vintasoft.Imaging.VintasoftImage renderedPage = docxDocument.Pages[i].Render())
            {
                // save rendered image to a PNG file
                renderedPage.Save(string.Format("page{0}.png", i));
            }
        }
    }
}

Inheritance Hierarchy
Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also