From a6e7a28754b977d797767e8ec1ae29b2070ab44a Mon Sep 17 00:00:00 2001 From: vderyushev Date: Wed, 3 Jul 2024 21:28:47 +0300 Subject: [PATCH] Updated tags --- .../ApiExamples/ExAbsolutePositionTab.cs | 1 + .../ApiExamples/ApiExamples/ExDocument.cs | 25 ++++++++++++++++--- .../ApiExamples/ExDocumentBuilder.cs | 12 +++++++-- Examples/ApiExamples/ApiExamples/ExFont.cs | 11 ++++++-- .../ApiExamples/ApiExamples/ExHeaderFooter.cs | 3 ++- .../ApiExamples/ExOoxmlSaveOptions.cs | 5 +++- .../ApiExamples/ApiExamples/ExParagraph.cs | 2 ++ .../ApiExamples/ApiExamples/ExPrinting.cs | 2 ++ .../ApiExamples/ExStructuredDocumentTag.cs | 1 + Examples/ApiExamples/ApiExamples/ExStyles.cs | 1 + .../ApiExamples/ExSvgSaveOptions.cs | 4 +++ .../ApiExamples/ExVariableCollection.cs | 5 ++++ 12 files changed, 63 insertions(+), 9 deletions(-) diff --git a/Examples/ApiExamples/ApiExamples/ExAbsolutePositionTab.cs b/Examples/ApiExamples/ApiExamples/ExAbsolutePositionTab.cs index 62638222..35f85b69 100644 --- a/Examples/ApiExamples/ApiExamples/ExAbsolutePositionTab.cs +++ b/Examples/ApiExamples/ApiExamples/ExAbsolutePositionTab.cs @@ -21,6 +21,7 @@ public class ExAbsolutePositionTab : ApiExampleBase //ExFor:Body.Accept(DocumentVisitor) //ExFor:Body.AcceptStart(DocumentVisitor) //ExFor:Body.AcceptEnd(DocumentVisitor) + //ExFor:VisitorAction //ExSummary:Shows how to process absolute position tab characters with a document visitor. [Test] //ExSkip public void DocumentToTxt() diff --git a/Examples/ApiExamples/ApiExamples/ExDocument.cs b/Examples/ApiExamples/ApiExamples/ExDocument.cs index 12a55d2c..cb49329f 100644 --- a/Examples/ApiExamples/ApiExamples/ExDocument.cs +++ b/Examples/ApiExamples/ApiExamples/ExDocument.cs @@ -514,10 +514,16 @@ public void LoadEncrypted() [Test] public void NotSupportedWarning() { - WarningInfoCollection warings = new WarningInfoCollection(); - Document doc = new Document(MyDir + "FB2 document.fb2", new LoadOptions { WarningCallback = warings }); + //ExStart + //ExFor:WarningInfoCollection.Count + //ExFor:WarningInfoCollection.Item(Int32) + //ExSummary:Shows how to get warnings about unsupported formats. + WarningInfoCollection warnings = new WarningInfoCollection(); + Document doc = new Document(MyDir + "FB2 document.fb2", new LoadOptions { WarningCallback = warnings }); - Assert.AreEqual("The original file load format is FB2, which is not supported by Aspose.Words. The file is loaded as an XML document.", warings[0].Description); + Assert.AreEqual("The original file load format is FB2, which is not supported by Aspose.Words. The file is loaded as an XML document.", warnings[0].Description); + Assert.AreEqual(1, warnings.Count); + //ExEnd } [Test] @@ -590,6 +596,7 @@ public void SaveToStream() } //ExStart + //ExFor:Range.Fields //ExFor:INodeChangingCallback //ExFor:INodeChangingCallback.NodeInserting //ExFor:INodeChangingCallback.NodeInserted @@ -1568,6 +1575,7 @@ public void DefaultTemplate() public void UseSubstitutions() { //ExStart + //ExFor:FindReplaceOptions.#ctor //ExFor:FindReplaceOptions.UseSubstitutions //ExFor:FindReplaceOptions.LegacyMode //ExSummary:Shows how to recognize and use substitutions within replacement patterns. @@ -2294,9 +2302,12 @@ public void EpubCover() public void TextWatermark() { //ExStart + //ExFor:Document.Watermark + //ExFor:Watermark //ExFor:Watermark.SetText(String) //ExFor:Watermark.SetText(String, TextWatermarkOptions) //ExFor:Watermark.Remove + //ExFor:TextWatermarkOptions //ExFor:TextWatermarkOptions.FontFamily //ExFor:TextWatermarkOptions.FontSize //ExFor:TextWatermarkOptions.Color @@ -2304,6 +2315,7 @@ public void TextWatermark() //ExFor:TextWatermarkOptions.IsSemitrasparent //ExFor:WatermarkLayout //ExFor:WatermarkType + //ExFor:Watermark.Type //ExSummary:Shows how to create a text watermark. Document doc = new Document(); @@ -2340,6 +2352,8 @@ public void ImageWatermark() //ExFor:Watermark.SetImage(Image, ImageWatermarkOptions) //ExFor:ImageWatermarkOptions.Scale //ExFor:ImageWatermarkOptions.IsWashout + //ExFor:Watermark.SetImage(Image) + //ExFor:Watermark.SetImage(String, ImageWatermarkOptions) //ExSummary:Shows how to create a watermark from an image in the local file system. Document doc = new Document(); @@ -2350,7 +2364,12 @@ public void ImageWatermark() imageWatermarkOptions.IsWashout = false; #if NET461_OR_GREATER || JAVA + // We have a different options to insert image: doc.Watermark.SetImage(Image.FromFile(ImageDir + "Logo.jpg"), imageWatermarkOptions); + + doc.Watermark.SetImage(Image.FromFile(ImageDir + "Logo.jpg")); + + doc.Watermark.SetImage(ImageDir + "Logo.jpg", imageWatermarkOptions); #elif NET5_0_OR_GREATER using (SKBitmap image = SKBitmap.Decode(ImageDir + "Logo.jpg")) { diff --git a/Examples/ApiExamples/ApiExamples/ExDocumentBuilder.cs b/Examples/ApiExamples/ApiExamples/ExDocumentBuilder.cs index 3242de94..6c11305a 100644 --- a/Examples/ApiExamples/ApiExamples/ExDocumentBuilder.cs +++ b/Examples/ApiExamples/ApiExamples/ExDocumentBuilder.cs @@ -1905,6 +1905,7 @@ public void SignatureLineProviderId() //ExFor:SignatureLine.IsSigned //ExFor:SignatureLine.IsValid //ExFor:SignatureLine.ProviderId + //ExFor:SignatureLineOptions //ExFor:SignatureLineOptions.ShowDate //ExFor:SignatureLineOptions.Email //ExFor:SignatureLineOptions.DefaultInstructions @@ -3011,6 +3012,9 @@ public void SmartStyleBehavior() [Test] public void EmphasesWarningSourceMarkdown() { + //ExStart + //ExFor:WarningInfo.Source + //ExSummary:Shows how to work with the warning source. Document doc = new Document(MyDir + "Emphases markdown warning.docx"); WarningInfoCollection warnings = new WarningInfoCollection(); @@ -3022,6 +3026,7 @@ public void EmphasesWarningSourceMarkdown() if (warningInfo.Source == WarningSource.Markdown) Assert.AreEqual("The (*, 0:11) cannot be properly written into Markdown.", warningInfo.Description); } + //ExEnd } [Test] @@ -3546,6 +3551,7 @@ public void PhoneticGuide() //ExStart //ExFor:Run.IsPhoneticGuide //ExFor:Run.PhoneticGuide + //ExFor:PhoneticGuide //ExFor:PhoneticGuide.BaseText //ExFor:PhoneticGuide.RubyText //ExSummary:Shows how to get properties of the phonetic guide. @@ -3554,8 +3560,10 @@ public void PhoneticGuide() RunCollection runs = doc.FirstSection.Body.FirstParagraph.Runs; // Use phonetic guide in the Asian text. Assert.AreEqual(true, runs[0].IsPhoneticGuide); - Assert.AreEqual("base", runs[0].PhoneticGuide.BaseText); - Assert.AreEqual("ruby", runs[0].PhoneticGuide.RubyText); + + PhoneticGuide phoneticGuide = runs[0].PhoneticGuide; + Assert.AreEqual("base", phoneticGuide.BaseText); + Assert.AreEqual("ruby", phoneticGuide.RubyText); //ExEnd } } diff --git a/Examples/ApiExamples/ApiExamples/ExFont.cs b/Examples/ApiExamples/ApiExamples/ExFont.cs index f73a2286..47774413 100644 --- a/Examples/ApiExamples/ApiExamples/ExFont.cs +++ b/Examples/ApiExamples/ApiExamples/ExFont.cs @@ -626,6 +626,7 @@ public void ComplexScript() public void SparklingText() { //ExStart + //ExFor:TextEffect //ExFor:Font.TextEffect //ExSummary:Shows how to apply a visual effect to a run. Document doc = new Document(); @@ -1064,7 +1065,7 @@ public void SetFontAutoColor() //ExStart //ExFor:Font.Hidden - //ExFor:Paragraph.Accept + //ExFor:Paragraph.Accept(DocumentVisitor) //ExFor:DocumentVisitor.VisitParagraphStart(Paragraph) //ExFor:DocumentVisitor.VisitFormField(FormField) //ExFor:DocumentVisitor.VisitTableEnd(Table) @@ -1076,7 +1077,9 @@ public void SetFontAutoColor() //ExFor:DocumentVisitor.VisitCommentStart(Comment) //ExFor:DocumentVisitor.VisitFootnoteStart(Footnote) //ExFor:SpecialChar - //ExFor:Node.Accept + //ExFor:SpecialChar.Accept(DocumentVisitor) + //ExFor:SpecialChar.GetText + //ExFor:Node.Accept(DocumentVisitor) //ExFor:Paragraph.ParagraphBreakFont //ExFor:Table.Accept(DocumentVisitor) //ExFor:Table.AcceptStart(DocumentVisitor) @@ -1228,6 +1231,8 @@ public override VisitorAction VisitFootnoteStart(Footnote footnote) /// public override VisitorAction VisitSpecialChar(SpecialChar specialChar) { + Console.WriteLine(specialChar.GetText()); + if (specialChar.Font.Hidden) specialChar.Remove(); @@ -1447,6 +1452,7 @@ public void HasDmlEffect() { //ExStart //ExFor:Font.HasDmlEffect(TextDmlEffect) + //ExFor:TextDmlEffect //ExSummary:Shows how to check if a run displays a DrawingML text effect. Document doc = new Document(MyDir + "DrawingML text effects.docx"); @@ -1642,3 +1648,4 @@ public void CreateThemedStyle() } } } + diff --git a/Examples/ApiExamples/ApiExamples/ExHeaderFooter.cs b/Examples/ApiExamples/ApiExamples/ExHeaderFooter.cs index 7c94351d..e570d7b2 100644 --- a/Examples/ApiExamples/ApiExamples/ExHeaderFooter.cs +++ b/Examples/ApiExamples/ApiExamples/ExHeaderFooter.cs @@ -254,6 +254,7 @@ public void ReplaceText() //ExStart //ExFor:IReplacingCallback //ExFor:PageSetup.DifferentFirstPageHeaderFooter + //ExFor:FindReplaceOptions.#ctor(IReplacingCallback) //ExSummary:Shows how to track the order in which a text replacement operation traverses nodes. [TestCase(false)] //ExSkip [TestCase(true)] //ExSkip @@ -264,7 +265,7 @@ public void Order(bool differentFirstPageHeaderFooter) Section firstPageSection = doc.FirstSection; ReplaceLog logger = new ReplaceLog(); - FindReplaceOptions options = new FindReplaceOptions { ReplacingCallback = logger }; + FindReplaceOptions options = new FindReplaceOptions(logger); // Using a different header/footer for the first page will affect the search order. firstPageSection.PageSetup.DifferentFirstPageHeaderFooter = differentFirstPageHeaderFooter; diff --git a/Examples/ApiExamples/ApiExamples/ExOoxmlSaveOptions.cs b/Examples/ApiExamples/ApiExamples/ExOoxmlSaveOptions.cs index dc2cfb14..f500af66 100644 --- a/Examples/ApiExamples/ApiExamples/ExOoxmlSaveOptions.cs +++ b/Examples/ApiExamples/ApiExamples/ExOoxmlSaveOptions.cs @@ -17,6 +17,7 @@ using Aspose.Words.Saving; using Aspose.Words.Settings; using NUnit.Framework; +using static System.Windows.Forms.VisualStyles.VisualStyleElement.ListView; namespace ApiExamples { @@ -410,6 +411,8 @@ public void DigitalSignature() //ExStart:DigitalSignature //GistId:5f20ac02cb42c6b08481aa1c5b0cd3db //ExFor:OoxmlSaveOptions.DigitalSignatureDetails + //ExFor:DigitalSignatureDetails + //ExFor:DigitalSignatureDetails.#ctor(CertificateHolder, SignOptions) //ExSummary:Shows how to sign OOXML document. Document doc = new Document(MyDir + "Document.docx"); @@ -423,4 +426,4 @@ public void DigitalSignature() //ExEnd:DigitalSignature } } -} +} \ No newline at end of file diff --git a/Examples/ApiExamples/ApiExamples/ExParagraph.cs b/Examples/ApiExamples/ApiExamples/ExParagraph.cs index c981ffb8..d29d9237 100644 --- a/Examples/ApiExamples/ApiExamples/ExParagraph.cs +++ b/Examples/ApiExamples/ApiExamples/ExParagraph.cs @@ -571,6 +571,8 @@ public void BreakIsStyleSeparator() public void TabStops() { //ExStart + //ExFor:TabLeader + //ExFor:TabAlignment //ExFor:Paragraph.GetEffectiveTabStops //ExSummary:Shows how to set custom tab stops for a paragraph. Document doc = new Document(); diff --git a/Examples/ApiExamples/ApiExamples/ExPrinting.cs b/Examples/ApiExamples/ApiExamples/ExPrinting.cs index bfc485c1..0701eaaa 100644 --- a/Examples/ApiExamples/ApiExamples/ExPrinting.cs +++ b/Examples/ApiExamples/ApiExamples/ExPrinting.cs @@ -130,6 +130,7 @@ public void PrintPageInfo() { //ExStart //ExFor:PageInfo + //ExFor:PageInfo.GetSizeInPixels(Single, Single) //ExFor:PageInfo.GetSizeInPixels(Single, Single, Single) //ExFor:PageInfo.GetSpecifiedPrinterPaperSource(PaperSourceCollection, PaperSource) //ExFor:PageInfo.HeightInPoints @@ -269,6 +270,7 @@ public void PrintRange() public void PreviewAndPrint() { //ExStart + //ExFor:AsposeWordsPrintDocument //ExFor:AsposeWordsPrintDocument.#ctor(Document) //ExFor:AsposeWordsPrintDocument.CachePrinterSettings //ExFor:AsposeWordsPrintDocument.ColorMode diff --git a/Examples/ApiExamples/ApiExamples/ExStructuredDocumentTag.cs b/Examples/ApiExamples/ApiExamples/ExStructuredDocumentTag.cs index 4e64f37b..e37a7e4a 100644 --- a/Examples/ApiExamples/ApiExamples/ExStructuredDocumentTag.cs +++ b/Examples/ApiExamples/ApiExamples/ExStructuredDocumentTag.cs @@ -1147,6 +1147,7 @@ public StructuredDocumentTagRangeStart InsertStructuredDocumentTagRanges(Documen public void GetSdt() { //ExStart + //ExFor:Range.StructuredDocumentTags //ExFor:StructuredDocumentTagCollection.Remove(int) //ExFor:StructuredDocumentTagCollection.RemoveAt(int) //ExSummary:Shows how to remove structured document tag. diff --git a/Examples/ApiExamples/ApiExamples/ExStyles.cs b/Examples/ApiExamples/ApiExamples/ExStyles.cs index 51f6dd01..76920b91 100644 --- a/Examples/ApiExamples/ApiExamples/ExStyles.cs +++ b/Examples/ApiExamples/ApiExamples/ExStyles.cs @@ -183,6 +183,7 @@ public void ChangeTocsTabStops() public void CopyStyleSameDocument() { //ExStart + //ExFor:StyleCollection.Add(Style) //ExFor:StyleCollection.AddCopy(Style) //ExFor:Style.Name //ExSummary:Shows how to clone a document's style. diff --git a/Examples/ApiExamples/ApiExamples/ExSvgSaveOptions.cs b/Examples/ApiExamples/ApiExamples/ExSvgSaveOptions.cs index 21999c2d..037c3d81 100644 --- a/Examples/ApiExamples/ApiExamples/ExSvgSaveOptions.cs +++ b/Examples/ApiExamples/ApiExamples/ExSvgSaveOptions.cs @@ -90,6 +90,7 @@ public void SaveOfficeMath() //ExStart:SaveOfficeMath //GistId:a775441ecb396eea917a2717cb9e8f8f //ExFor:NodeRendererBase.Save(String, SvgSaveOptions) + //ExFor:NodeRendererBase.Save(Stream, SvgSaveOptions) //ExSummary:Shows how to pass save options when rendering office math. Document doc = new Document(MyDir + "Office math.docx"); @@ -99,6 +100,9 @@ public void SaveOfficeMath() options.TextOutputMode = SvgTextOutputMode.UsePlacedGlyphs; math.GetMathRenderer().Save(ArtifactsDir + "SvgSaveOptions.Output.svg", options); + + using (MemoryStream stream = new MemoryStream()) + math.GetMathRenderer().Save(stream, options); //ExEnd:SaveOfficeMath } diff --git a/Examples/ApiExamples/ApiExamples/ExVariableCollection.cs b/Examples/ApiExamples/ApiExamples/ExVariableCollection.cs index 7423d5a1..75292192 100644 --- a/Examples/ApiExamples/ApiExamples/ExVariableCollection.cs +++ b/Examples/ApiExamples/ApiExamples/ExVariableCollection.cs @@ -31,6 +31,8 @@ public void Primer() //ExFor:VariableCollection.IndexOfKey //ExFor:VariableCollection.Remove //ExFor:VariableCollection.RemoveAt + //ExFor:VariableCollection.Item(Int32) + //ExFor:VariableCollection.Item(String) //ExSummary:Shows how to work with a document's variable collection. Document doc = new Document(); VariableCollection variables = doc.Variables; @@ -69,6 +71,9 @@ public void Primer() Assert.AreEqual(1, variables.IndexOfKey("City")); Assert.AreEqual(2, variables.IndexOfKey("Home address")); + Assert.AreEqual("3", variables[0]); + Assert.AreEqual("London", variables["City"]); + // Enumerate over the collection of variables. using (IEnumerator> enumerator = doc.Variables.GetEnumerator()) while (enumerator.MoveNext())