有没有办法获取word文件中包含的所有样式名称的列表?我正在使用Spire.Doc,我知道如何获得所有使用的样式,但我需要所有可用的样式名称。
答案 0 :(得分:0)
检查:
object missing = System.Reflection.Missing.Value;
object fileName = "C:\\test.docx";
Microsoft.Office.Interop.Word.Application applicationWord = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Word.Document documentWord = new Microsoft.Office.Interop.Word.Document();
documentWord = applicationWord.Documents.Open(ref fileName, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
foreach (Microsoft.Office.Interop.Word.Style currentStyle in documentWord.Styles)
{
string name = currentStyle.NameLocal;
}