gpt4 book ai didi

c# - 我如何知道单词列表是项目符号列表还是数字列表?

转载 作者:太空宇宙 更新时间:2023-11-03 21:14:22 26 4
gpt4 key购买 nike

我正在阅读一个 word 文档(将其转换为 HTML)并想知道每个段落的类型(至少我认为我想这样做)。

我的代码是这样的

Application application = new Application();
var doc = application.Documents.Open("D:\\myDoc.docx");

for (int i = 0; i < doc.Paragraphs.Count; i++)
{
Console.WriteLine($"{doc.Paragraphs[i + 1].Range.ParagraphStyle.NameLocal}");
}

例如,这会输出 Header 1NormalList Paragraph。所以我的问题。我看不出 List Paragraph 是项目符号列表还是数字列表。问题,我怎么知道列表是什么类型?

最佳答案

使用 Range.ListFormat.ListType 可以有以下值:

// Summary:
// Specifies a type of list.
public enum WdListType
{
// Summary:
// List with no bullets, numbering, or outlining.
wdListNoNumbering = 0,
//
// Summary:
// ListNum fields that can be used in the body of a paragraph.
wdListListNumOnly = 1,
//
// Summary:
// Bulleted list.
wdListBullet = 2,
//
// Summary:
// Simple numeric list.
wdListSimpleNumbering = 3,
//
// Summary:
// Outlined list.
wdListOutlineNumbering = 4,
//
// Summary:
// Mixed numeric list.
wdListMixedNumbering = 5,
//
// Summary:
// Picture bulleted list.
wdListPictureBullet = 6,
}

关于c# - 我如何知道单词列表是项目符号列表还是数字列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35460990/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com