VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Office.OpenXml.Docx Namespace / DocxDocument Class / DocumentInformation Property
Синтаксис Example Требования Смотрите также
В этом разделе
    DocumentInformation Свойство (DocxDocument)
    В этом разделе
    Возвращает информацию (автор, дату изменения и т. д.) об этом документе DOCX.
    Синтаксис
    Пример

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

    
    ''' <summary>
    ''' Shows information about DOCX document.
    ''' </summary>
    ''' <param name="filename">A name of DOCX file.</param>
    Public Shared Sub ShowDocxDocumentInfo(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)
            ' print information about DOCX document
    
            System.Console.WriteLine(String.Format("DOCX document ""{0}"" information:", filename))
            System.Console.WriteLine(String.Format(" - Page count: {0}", docxDocument.Pages.Count))
            System.Console.WriteLine(String.Format(" - Category: {0}", docxDocument.DocumentInformation.Category))
            System.Console.WriteLine(String.Format(" - ContentStatus: {0}", docxDocument.DocumentInformation.ContentStatus))
            System.Console.WriteLine(String.Format(" - ContentType: {0}", docxDocument.DocumentInformation.ContentType))
            System.Console.WriteLine(String.Format(" - Created: {0}", docxDocument.DocumentInformation.Created))
            System.Console.WriteLine(String.Format(" - Creator: {0}", docxDocument.DocumentInformation.Creator))
            System.Console.WriteLine(String.Format(" - Description: {0}", docxDocument.DocumentInformation.Description))
            System.Console.WriteLine(String.Format(" - Identifier: {0}", docxDocument.DocumentInformation.Identifier))
            System.Console.WriteLine(String.Format(" - Keywords: {0}", docxDocument.DocumentInformation.Keywords))
            System.Console.WriteLine(String.Format(" - Language: {0}", docxDocument.DocumentInformation.Language))
            System.Console.WriteLine(String.Format(" - LastModifiedBy: {0}", docxDocument.DocumentInformation.LastModifiedBy))
            System.Console.WriteLine(String.Format(" - LastPrinted: {0}", docxDocument.DocumentInformation.LastPrinted))
            System.Console.WriteLine(String.Format(" - Modified: {0}", docxDocument.DocumentInformation.Modified))
            System.Console.WriteLine(String.Format(" - Revision: {0}", docxDocument.DocumentInformation.Revision))
            System.Console.WriteLine(String.Format(" - Subject: {0}", docxDocument.DocumentInformation.Subject))
            System.Console.WriteLine(String.Format(" - Title: {0}", docxDocument.DocumentInformation.Title))
            System.Console.WriteLine(String.Format(" - Version: {0}", docxDocument.DocumentInformation.Version))
        End Using
    
        System.Console.WriteLine("Press any key...")
        System.Console.ReadKey()
    End Sub
    
    
    
    /// <summary>
    /// Shows information about DOCX document.
    /// </summary>
    /// <param name="filename">A name of DOCX file.</param>
    public static void ShowDocxDocumentInfo(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))
        {
            // print information about DOCX document
    
            System.Console.WriteLine(string.Format("DOCX document \"{0}\" information:", filename));
            System.Console.WriteLine(string.Format(" - Page count: {0}", docxDocument.Pages.Count));
            System.Console.WriteLine(string.Format(" - Category: {0}", docxDocument.DocumentInformation.Category));
            System.Console.WriteLine(string.Format(" - ContentStatus: {0}", docxDocument.DocumentInformation.ContentStatus));
            System.Console.WriteLine(string.Format(" - ContentType: {0}", docxDocument.DocumentInformation.ContentType));
            System.Console.WriteLine(string.Format(" - Created: {0}", docxDocument.DocumentInformation.Created));
            System.Console.WriteLine(string.Format(" - Creator: {0}", docxDocument.DocumentInformation.Creator));
            System.Console.WriteLine(string.Format(" - Description: {0}", docxDocument.DocumentInformation.Description));
            System.Console.WriteLine(string.Format(" - Identifier: {0}", docxDocument.DocumentInformation.Identifier));
            System.Console.WriteLine(string.Format(" - Keywords: {0}", docxDocument.DocumentInformation.Keywords));
            System.Console.WriteLine(string.Format(" - Language: {0}", docxDocument.DocumentInformation.Language));
            System.Console.WriteLine(string.Format(" - LastModifiedBy: {0}", docxDocument.DocumentInformation.LastModifiedBy));
            System.Console.WriteLine(string.Format(" - LastPrinted: {0}", docxDocument.DocumentInformation.LastPrinted));
            System.Console.WriteLine(string.Format(" - Modified: {0}", docxDocument.DocumentInformation.Modified));
            System.Console.WriteLine(string.Format(" - Revision: {0}", docxDocument.DocumentInformation.Revision));
            System.Console.WriteLine(string.Format(" - Subject: {0}", docxDocument.DocumentInformation.Subject));
            System.Console.WriteLine(string.Format(" - Title: {0}", docxDocument.DocumentInformation.Title));
            System.Console.WriteLine(string.Format(" - Version: {0}", docxDocument.DocumentInformation.Version));
        }
    
        System.Console.WriteLine("Press any key...");
        System.Console.ReadKey();
    }
    
    

    Требования

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

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