Skip to content

Commit

Permalink
Updated tags
Browse files Browse the repository at this point in the history
  • Loading branch information
vderyushev committed Jul 3, 2024
1 parent 52a0847 commit a6e7a28
Showing 12 changed files with 63 additions and 9 deletions.
1 change: 1 addition & 0 deletions Examples/ApiExamples/ApiExamples/ExAbsolutePositionTab.cs
Original file line number Diff line number Diff line change
@@ -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()
25 changes: 22 additions & 3 deletions Examples/ApiExamples/ApiExamples/ExDocument.cs
Original file line number Diff line number Diff line change
@@ -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,16 +2302,20 @@ 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
//ExFor:TextWatermarkOptions.Layout
//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"))
{
12 changes: 10 additions & 2 deletions Examples/ApiExamples/ApiExamples/ExDocumentBuilder.cs
Original file line number Diff line number Diff line change
@@ -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
}
}
11 changes: 9 additions & 2 deletions Examples/ApiExamples/ApiExamples/ExFont.cs
Original file line number Diff line number Diff line change
@@ -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)
/// </summary>
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()
}
}
}

3 changes: 2 additions & 1 deletion Examples/ApiExamples/ApiExamples/ExHeaderFooter.cs
Original file line number Diff line number Diff line change
@@ -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;
5 changes: 4 additions & 1 deletion Examples/ApiExamples/ApiExamples/ExOoxmlSaveOptions.cs
Original file line number Diff line number Diff line change
@@ -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
}
}
}
}
2 changes: 2 additions & 0 deletions Examples/ApiExamples/ApiExamples/ExParagraph.cs
Original file line number Diff line number Diff line change
@@ -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();
2 changes: 2 additions & 0 deletions Examples/ApiExamples/ApiExamples/ExPrinting.cs
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions Examples/ApiExamples/ApiExamples/ExStyles.cs
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 4 additions & 0 deletions Examples/ApiExamples/ApiExamples/ExSvgSaveOptions.cs
Original file line number Diff line number Diff line change
@@ -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
}

5 changes: 5 additions & 0 deletions Examples/ApiExamples/ApiExamples/ExVariableCollection.cs
Original file line number Diff line number Diff line change
@@ -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<KeyValuePair<string, string>> enumerator = doc.Variables.GetEnumerator())
while (enumerator.MoveNext())

0 comments on commit a6e7a28

Please sign in to comment.