VintaSoft Imaging .NET SDK 15.2: Документация для .NET разработчика
Vintasoft.Imaging.Office.OpenXml.Docx Namespace / DocxPageCollection Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
Класс DocxPageCollection
В этом разделе
Представляет коллекцию объектов DocxPage.
Объектная модель
DocxPage DocxPageCollection
Синтаксис
Пример

Вот пример, показывающий, как визуализировать все страницы документа DOCX и сохранять визуализированные изображения в файлы PNG:


''' <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));
            }
        }
    }
}

Иерархия наследования
Требования

Целевые платформы: .NET 11; .NET 10; .NET 9; .NET 8; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

Смотрите также