コード例 #1
0
        public void GetDocumentFonts()
        {
            //ExStart:
            //ExFor:FontInfoCollection
            //ExFor:DocumentBase.FontInfos
            //ExFor:FontInfo
            //ExFor:FontInfo.Name
            //ExFor:FontInfo.IsTrueType
            //ExSummary:Shows how to gather the details of what fonts are present in a document.
            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++;
            }
            //ExEnd
        }
コード例 #2
0
        public void WorkWithEmbeddedFonts(bool embedTrueTypeFonts, bool embedSystemFonts, bool saveSubsetFonts)
        {
            Document doc = new Document(MyDir + "Document.doc");

            FontInfoCollection fontInfos = doc.FontInfos;

            fontInfos.EmbedTrueTypeFonts = embedTrueTypeFonts;
            fontInfos.EmbedSystemFonts   = embedSystemFonts;
            fontInfos.SaveSubsetFonts    = saveSubsetFonts;

            doc.Save(MyDir + @"/Artifacts/Document.docx");
        }
コード例 #3
0
        public void FontInfoCollection()
        {
            //ExStart
            //ExFor:FontInfoCollection
            //ExFor:DocumentBase.FontInfos
            //ExFor:FontInfoCollection.EmbedTrueTypeFonts
            //ExFor:FontInfoCollection.EmbedSystemFonts
            //ExFor:FontInfoCollection.SaveSubsetFonts
            //ExSummary:Shows how to save a document with embedded TrueType fonts
            Document doc = new Document(MyDir + "Document.docx");

            FontInfoCollection fontInfos = doc.FontInfos;

            fontInfos.EmbedTrueTypeFonts = true;
            fontInfos.EmbedSystemFonts   = false;
            fontInfos.SaveSubsetFonts    = false;

            doc.Save(MyDir + @"/Artifacts/Document.docx");
            //ExEnd
        }