【问题标题】:Aspose referenced fontsAspose 引用的字体
【发布时间】:2019-01-08 11:08:27
【问题描述】:

将文本从单词复制到另一个单词是否也会复制未使用的引用字体?如果是,有没有办法只检测使用的字体而不迭代整个段落? 谢谢你

【问题讨论】:

    标签: aspose aspose.words


    【解决方案1】:

    您必须遍历 Run 节点以获取有关文档中实际使用的字体的信息。请使用以下代码获取所需信息。

     NodeCollection runs = dstDoc.GetChildNodes(NodeType.Run, true);
    
     foreach(Run run in runs) {
      Console.WriteLine("Font Name: {0}", run.Font.Name);
    
     }
    

    希望,这会有所帮助。

    我与 Aspose 一起担任开发人员宣传员。

    【讨论】:

      【解决方案2】:

      是的,Aspose.Words 也会复制未使用的引用字体。请使用以下代码获取有关文档中使用的所有字体的信息。

      Document doc = new Document(MyDir + "Document.doc");
      
      FontInfoCollection fonts = doc.FontInfos;
      int fontIndex = 1;
      
      // The fonts info extracted from this document does not necessarily mean that the fonts themselves are
      // used in the document. If a font is present but not used then most likely they were referenced at some time
      // and then removed from the Document.
      foreach (FontInfo info in fonts)
      {
          // Print out some important details about the font.
          Console.WriteLine("Font #{0}", fontIndex);
          Console.WriteLine("Name: {0}", info.Name);
          Console.WriteLine("IsTrueType: {0}", info.IsTrueType);
          fontIndex++;
      }
      

      希望,这会有所帮助。

      我与 Aspose 合作,担任开发人员宣传员。

      【讨论】:

      • 当然不用了,我问是不是抄的?
      • 欢迎提供解决方案的链接,但请确保您的答案在没有它的情况下有用:add context around the link 这样您的其他用户就会知道它是什么以及为什么会出现,然后引用最相关的您链接到的页面的一部分,以防目标页面不可用。 Answers that are little more than a link may be deleted.
      • 是的,Aspose.Words 也会复制未使用的引用字体。
      • 感谢您的回答,但请阅读我的完整问题,我问如果是,如何知道真正使用的字体,不包括引用的字体
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多