1. 使用Microsoft.Office.Interop.Word命名空间:
using Microsoft.Office.Interop.Word;

Application wordApp = new Application();
ListGalleries listGalleries = wordApp.ListGalleries;
int count = listGalleries.Count;
  1. 使用Open XML SDK:
using DocumentFormat.OpenXml.Wordprocessing;

using (WordprocessingDocument wordDoc = WordprocessingDocument.Open("Document.docx", true))
{
    ListGallery listGallery = wordDoc.MainDocumentPart.DocumentSettingsPart.Settings.Descendants<ListGallery>().FirstOrDefault();
    int count = listGallery.Count;
}
  1. 使用Aspose.Words:
using Aspose.Words;

Document doc = new Document("Document.docx");
ListGalleries listGalleries = doc.ListGalleries;
int count = listGalleries.Count;
  1. 使用Spire.Doc:
using Spire.Doc;

Document doc = new Document();
ListGallery listGallery = doc.ListGalleries;
int count = listGallery.Count;
  1. 使用GemBox.Document:
using GemBox.Document;

DocumentModel document = DocumentModel.Load("Document.docx");
ListGallery listGallery = document.Settings.ListGallery;
int count = listGallery.Count;
``
请用C#写出5种word 项目列表ListGalleries继续编号代码

原文地址: https://www.cveoy.top/t/topic/hxs8 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录