Skip to content

Commit

Permalink
Added ExFor tags
Browse files Browse the repository at this point in the history
  • Loading branch information
vderyushev committed Jul 4, 2024
1 parent 2dd58c7 commit 87b207b
Show file tree
Hide file tree
Showing 24 changed files with 181 additions and 38 deletions.
21 changes: 20 additions & 1 deletion Examples/ApiExamples/ApiExamples/ExCharts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,13 @@ public void AxisProperties()
//ExFor:ChartAxis.MinorTickMark
//ExFor:ChartAxis.MajorUnit
//ExFor:ChartAxis.MinorUnit
//ExFor:AxisTickLabels
//ExFor:AxisTickLabels.Offset
//ExFor:AxisTickLabels.Position
//ExFor:AxisTickLabels.IsAutoSpacing
//ExFor:AxisTickLabels.Alignment
//ExFor:AxisTickLabels.Font
//ExFor:AxisTickLabels.Spacing
//ExFor:ChartAxis.TickMarkSpacing
//ExFor:AxisCategoryType
//ExFor:AxisCrosses
Expand Down Expand Up @@ -171,6 +175,9 @@ public void AxisProperties()
yAxis.MajorUnit = 100.0d;
yAxis.MinorUnit = 20.0d;
yAxis.TickLabels.Position = AxisTickLabelPosition.NextToAxis;
yAxis.TickLabels.Alignment = ParagraphAlignment.Center;
yAxis.TickLabels.Font.Color = Color.Red;
yAxis.TickLabels.Spacing = 1;

// Column charts do not have a Z-axis.
Assert.Null(chart.AxisZ);
Expand Down Expand Up @@ -201,6 +208,9 @@ public void AxisProperties()
Assert.AreEqual(100.0d, chart.AxisY.MajorUnit);
Assert.AreEqual(20.0d, chart.AxisY.MinorUnit);
Assert.AreEqual(AxisTickLabelPosition.NextToAxis, chart.AxisY.TickLabels.Position);
Assert.AreEqual(ParagraphAlignment.Center, chart.AxisY.TickLabels.Alignment);
Assert.AreEqual(Color.Red.ToArgb(), chart.AxisY.TickLabels.Font.Color.ToArgb());
Assert.AreEqual(1, chart.AxisY.TickLabels.Spacing);
}

[Test]
Expand Down Expand Up @@ -1223,6 +1233,7 @@ public void MarkerFormatting()
//ExFor:Stroke.BackColor
//ExFor:Stroke.Visible
//ExFor:Stroke.Transparency
//ExFor:PresetTexture
//ExFor:Fill.PresetTextured(PresetTexture)
//ExSummary:Show how to set marker formatting.
Document doc = new Document();
Expand Down Expand Up @@ -1357,6 +1368,7 @@ public void LegendFont()
{
//ExStart:LegendFont
//GistId:470c0da51e4317baae82ad9495747fed
//ExFor:ChartLegendEntry
//ExFor:ChartLegendEntry.Font
//ExFor:ChartLegend.Font
//ExSummary:Shows how to work with a legend font.
Expand Down Expand Up @@ -1404,6 +1416,7 @@ public void RemoveSpecificChartSeries()
public void PopulateChartWithData()
{
//ExStart
//ExFor:ChartXValue
//ExFor:ChartXValue.FromDouble(Double)
//ExFor:ChartYValue.FromDouble(Double)
//ExFor:ChartSeries.Add(ChartXValue, ChartYValue)
Expand Down Expand Up @@ -1681,6 +1694,7 @@ public void DataTable()
{
//ExStart:DataTable
//GistId:a775441ecb396eea917a2717cb9e8f8f
//ExFor:Chart.DataTable
//ExFor:ChartDataTable
//ExFor:ChartDataTable.Show
//ExSummary:Shows how to show data table with chart series data.
Expand Down Expand Up @@ -1718,6 +1732,7 @@ public void ChartFormat()
{
//ExStart:ChartFormat
//GistId:5f20ac02cb42c6b08481aa1c5b0cd3db
//ExFor:ChartFormat
//ExFor:Chart.Format
//ExFor:ChartTitle.Format
//ExFor:ChartAxisTitle.Format
Expand Down Expand Up @@ -1819,6 +1834,7 @@ public void ConfigureGapOverlap()
{
//ExStart:ConfigureGapOverlap
//GistId:6e4482e7434754c31c6f2f6e4bf48bb1
//ExFor:Chart.SeriesGroups
//ExFor:ChartSeriesGroup.GapWidth
//ExFor:ChartSeriesGroup.Overlap
//ExSummary:Show how to configure gap width and overlap.
Expand Down Expand Up @@ -1885,7 +1901,10 @@ public void TreemapChart()
//ExStart:TreemapChart
//GistId:65919861586e42e24f61a3ccb65f8f4e
//ExFor:ChartSeriesCollection.Add(String, ChartMultilevelValue[], double[])
//ExFor:ChartMultilevelValue
//ExFor:ChartMultilevelValue.#ctor(String, String, String)
//ExFor:ChartMultilevelValue.#ctor(String, String)
//ExFor:ChartMultilevelValue.#ctor(String)
//ExSummary:Shows how to create treemap chart.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Expand Down Expand Up @@ -1921,7 +1940,7 @@ public void TreemapChart()
new ChartMultilevelValue("Latin America", "Brazil"),
new ChartMultilevelValue("Latin America", "Mexico"),
new ChartMultilevelValue("Latin America", "Other"),
new ChartMultilevelValue("Northern America", "United States"),
new ChartMultilevelValue("Northern America", "United States", "Other"),
new ChartMultilevelValue("Northern America", "Other"),
new ChartMultilevelValue("Oceania")
},
Expand Down
1 change: 1 addition & 0 deletions Examples/ApiExamples/ApiExamples/ExComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public void PrintAllComments()
//ExFor:Comment.Ancestor
//ExFor:Comment.Author
//ExFor:Comment.Replies
//ExFor:CompositeNode.GetEnumerator
//ExFor:CompositeNode.GetChildNodes(NodeType, Boolean)
//ExSummary:Shows how to print all of a document's comments and their replies.
Document doc = new Document(MyDir + "Comments.docx");
Expand Down
1 change: 1 addition & 0 deletions Examples/ApiExamples/ApiExamples/ExDocSaveOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public void SaveAsDoc()
//ExFor:DocSaveOptions.Password
//ExFor:DocSaveOptions.SaveFormat
//ExFor:DocSaveOptions.SaveRoutingSlip
//ExFor:IncorrectPasswordException
//ExSummary:Shows how to set save options for older Microsoft Word formats.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Expand Down
5 changes: 5 additions & 0 deletions Examples/ApiExamples/ApiExamples/ExDocument.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ public void OpenFromStreamWithBaseUri()
//ExFor:Document.#ctor(Stream,LoadOptions)
//ExFor:LoadOptions.#ctor
//ExFor:LoadOptions.BaseUri
//ExFor:ShapeBase.IsImage
//ExSummary:Shows how to open an HTML document with images from a stream using a base URI.
using (Stream stream = File.OpenRead(MyDir + "Document.html"))
{
Expand Down Expand Up @@ -1603,6 +1604,7 @@ public void SetInvalidateFieldTypes()
{
//ExStart
//ExFor:Document.NormalizeFieldTypes
//ExFor:Range.NormalizeFieldTypes
//ExSummary:Shows how to get the keep a field's type up to date with its field code.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Expand Down Expand Up @@ -2158,6 +2160,7 @@ public void CreateWebExtension()
//ExStart
//ExFor:BaseWebExtensionCollection`1.Add(`0)
//ExFor:BaseWebExtensionCollection`1.Clear
//ExFor:Document.WebExtensionTaskPanes
//ExFor:TaskPane
//ExFor:TaskPane.DockState
//ExFor:TaskPane.IsVisible
Expand Down Expand Up @@ -2350,6 +2353,7 @@ public void ImageWatermark()
{
//ExStart
//ExFor:Watermark.SetImage(Image, ImageWatermarkOptions)
//ExFor:ImageWatermarkOptions
//ExFor:ImageWatermarkOptions.Scale
//ExFor:ImageWatermarkOptions.IsWashout
//ExFor:Watermark.SetImage(Image)
Expand Down Expand Up @@ -2642,6 +2646,7 @@ public void PageIsInColor()
{
//ExStart
//ExFor:PageInfo.Colored
//ExFor:Document.GetPageInfo(Int32)
//ExSummary:Shows how to check whether the page is in color or not.
Document doc = new Document(MyDir + "Document.docx");

Expand Down
2 changes: 2 additions & 0 deletions Examples/ApiExamples/ApiExamples/ExDocumentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ public void InsertHorizontalRule()
//ExFor:DocumentBuilder.InsertHorizontalRule
//ExFor:ShapeBase.IsHorizontalRule
//ExFor:Shape.HorizontalRuleFormat
//ExFor:HorizontalRuleAlignment
//ExFor:HorizontalRuleFormat
//ExFor:HorizontalRuleFormat.Alignment
//ExFor:HorizontalRuleFormat.WidthPercent
Expand Down Expand Up @@ -3014,6 +3015,7 @@ public void EmphasesWarningSourceMarkdown()
{
//ExStart
//ExFor:WarningInfo.Source
//ExFor:WarningSource
//ExSummary:Shows how to work with the warning source.
Document doc = new Document(MyDir + "Emphases markdown warning.docx");

Expand Down
60 changes: 47 additions & 13 deletions Examples/ApiExamples/ApiExamples/ExDocumentVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,14 @@ namespace ApiExamples
{
[TestFixture]
public class ExDocumentVisitor : ApiExampleBase
{
//ExStart
//ExFor:Document.Accept(DocumentVisitor)
//ExFor:SubDocument.Accept(DocumentVisitor)
{
//ExStart
//ExFor:Document.Accept(DocumentVisitor)
//ExFor:SubDocument.Accept(DocumentVisitor)
//ExFor:CompositeNode.AcceptEnd(DocumentVisitor)
//ExFor:CompositeNode.AcceptStart(DocumentVisitor)
//ExFor:Document.AcceptEnd(DocumentVisitor)
//ExFor:Document.AcceptStart(DocumentVisitor)
//ExFor:DocumentVisitor
//ExFor:DocumentVisitor.VisitRun(Run)
//ExFor:DocumentVisitor.VisitDocumentEnd(Document)
Expand All @@ -34,6 +38,8 @@ public class ExDocumentVisitor : ApiExampleBase
//ExFor:DocumentVisitor.VisitParagraphStart(Paragraph)
//ExFor:DocumentVisitor.VisitParagraphEnd(Paragraph)
//ExFor:DocumentVisitor.VisitSubDocument(SubDocument)
//ExFor:DocumentVisitor.VisitStructuredDocumentTagRangeEnd(StructuredDocumentTagRangeEnd)
//ExFor:DocumentVisitor.VisitStructuredDocumentTagRangeStart(StructuredDocumentTagRangeStart)
//ExSummary:Shows how to use a document visitor to print a document's node structure.
[Test] //ExSkip
public void DocStructureToText()
Expand Down Expand Up @@ -182,6 +188,26 @@ public override VisitorAction VisitSubDocument(SubDocument subDocument)
return VisitorAction.Continue;
}

/// <summary>
/// Called when a SubDocument node is encountered in the document.
/// </summary>
public override VisitorAction VisitStructuredDocumentTagRangeStart(StructuredDocumentTagRangeStart sdtRangeStart)
{
IndentAndAppendLine("[SdtRangeStart]");

return VisitorAction.Continue;
}

/// <summary>
/// Called when a SubDocument node is encountered in the document.
/// </summary>
public override VisitorAction VisitStructuredDocumentTagRangeEnd(StructuredDocumentTagRangeEnd sdtRangeEnd)
{
IndentAndAppendLine("[SdtRangeEnd]");

return VisitorAction.Continue;
}

/// <summary>
/// Append a line to the StringBuilder and indent it depending on how deep the visitor is into the document tree.
/// </summary>
Expand Down Expand Up @@ -651,6 +677,8 @@ private static void TestFieldToText(FieldStructurePrinter visitor)
//ExFor:DocumentVisitor.VisitHeaderFooterStart(HeaderFooter)
//ExFor:DocumentVisitor.VisitHeaderFooterEnd(HeaderFooter)
//ExFor:HeaderFooter.Accept(DocumentVisitor)
//ExFor:HeaderFooter.AcceptStart(DocumentVisitor)
//ExFor:HeaderFooter.AcceptEnd(DocumentVisitor)
//ExFor:HeaderFooterCollection.ToArray
//ExFor:Run.Accept(DocumentVisitor)
//ExFor:Run.GetText
Expand Down Expand Up @@ -861,6 +889,8 @@ private static void TestEditableRangeToText(EditableRangeStructurePrinter visito
//ExFor:DocumentVisitor.VisitFootnoteEnd(Footnote)
//ExFor:DocumentVisitor.VisitFootnoteStart(Footnote)
//ExFor:Footnote.Accept(DocumentVisitor)
//ExFor:Footnote.AcceptStart(DocumentVisitor)
//ExFor:Footnote.AcceptEnd(DocumentVisitor)
//ExSummary:Shows how to print the node structure of every footnote in a document.
[Test] //ExSkip
public void FootnoteToText()
Expand Down Expand Up @@ -955,15 +985,17 @@ private static void TestFootnoteToText(FootnoteStructurePrinter visitor)
Assert.True(visitorText.Contains("[Footnote start] Type: Footnote"));
Assert.True(visitorText.Contains("[Footnote end]"));
Assert.True(visitorText.Contains("[Run]"));
}

//ExStart
//ExFor:DocumentVisitor.VisitOfficeMathEnd(OfficeMath)
//ExFor:DocumentVisitor.VisitOfficeMathStart(OfficeMath)
//ExFor:MathObjectType
//ExFor:OfficeMath.Accept(DocumentVisitor)
//ExFor:OfficeMath.MathObjectType
//ExSummary:Shows how to print the node structure of every office math node in a document.
}

//ExStart
//ExFor:DocumentVisitor.VisitOfficeMathEnd(OfficeMath)
//ExFor:DocumentVisitor.VisitOfficeMathStart(OfficeMath)
//ExFor:MathObjectType
//ExFor:OfficeMath.Accept(DocumentVisitor)
//ExFor:OfficeMath.AcceptStart(DocumentVisitor)
//ExFor:OfficeMath.AcceptEnd(DocumentVisitor)
//ExFor:OfficeMath.MathObjectType
//ExSummary:Shows how to print the node structure of every office math node in a document.
[Test] //ExSkip
public void OfficeMathToText()
{
Expand Down Expand Up @@ -1174,6 +1206,8 @@ private static void TestSmartTagToText(SmartTagStructurePrinter visitor)

//ExStart
//ExFor:StructuredDocumentTag.Accept(DocumentVisitor)
//ExFor:StructuredDocumentTag.AcceptStart(DocumentVisitor)
//ExFor:StructuredDocumentTag.AcceptEnd(DocumentVisitor)
//ExFor:DocumentVisitor.VisitStructuredDocumentTagEnd(StructuredDocumentTag)
//ExFor:DocumentVisitor.VisitStructuredDocumentTagStart(StructuredDocumentTag)
//ExSummary:Shows how to print the node structure of every structured document tag in a document.
Expand Down
9 changes: 7 additions & 2 deletions Examples/ApiExamples/ApiExamples/ExDrawing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ public void FillSolid()
{
//ExStart
//ExFor:Fill.Color()
//ExFor:Fill.Solid(Color)
//ExFor:FillType
//ExFor:Fill.FillType
//ExFor:Fill.Solid
//ExFor:Fill.Transparency
//ExFor:Font.Fill
//ExSummary:Shows how to convert any of the fills back to solid fill.
Document doc = new Document(MyDir + "Two color gradient.docx");
Expand All @@ -252,7 +255,7 @@ public void FillSolid()
Console.WriteLine("The fill is transparent at {0}%", fill.Transparency * 100);

// Change type of the fill to Solid with uniform green color.
fill.Solid(Color.Green);
fill.Solid();
Console.WriteLine("\nThe fill is changed:");
Console.WriteLine("The type of the fill is: {0}", fill.FillType);
Console.WriteLine("The foreground color of the fill is: {0}", fill.ForeColor);
Expand Down Expand Up @@ -341,6 +344,8 @@ public void StrokePattern()
//ExFor:GroupShape
//ExFor:GroupShape.#ctor(DocumentBase)
//ExFor:GroupShape.Accept(DocumentVisitor)
//ExFor:GroupShape.AcceptStart(DocumentVisitor)
//ExFor:GroupShape.AcceptEnd(DocumentVisitor)
//ExFor:ShapeBase.IsGroup
//ExFor:ShapeBase.ShapeType
//ExSummary:Shows how to create a group of shapes, and print its contents using a document visitor.
Expand Down
13 changes: 13 additions & 0 deletions Examples/ApiExamples/ApiExamples/ExField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ public void FieldDatabase()
//ExFor:FieldDatabase.LastRecord
//ExFor:FieldDatabase.Query
//ExFor:FieldDatabase.TableFormat
//ExFor:FieldDatabaseDataTable
//ExFor:IFieldDatabaseProvider
//ExFor:IFieldDatabaseProvider.GetQueryResult(String,String,String,FieldDatabase)
//ExSummary:Shows how to extract data from a database and insert it as a field into a document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Expand Down Expand Up @@ -2536,6 +2539,7 @@ public void FieldCitation()

//ExStart
//ExFor:IBibliographyStylesProvider
//ExFor:IBibliographyStylesProvider.GetStyle(String)
//ExFor:FieldOptions.BibliographyStylesProvider
//ExSummary:Shows how to override built-in styles or provide custom one.
[Test] //ExSkip
Expand Down Expand Up @@ -4896,6 +4900,7 @@ public void FieldBuilder()
//ExFor:FieldBuilder.AddSwitch(String, String)
//ExFor:FieldBuilder.BuildAndInsert(Paragraph)
//ExFor:FieldArgumentBuilder
//ExFor:FieldArgumentBuilder.#ctor
//ExFor:FieldArgumentBuilder.AddField(FieldBuilder)
//ExFor:FieldArgumentBuilder.AddText(String)
//ExFor:FieldArgumentBuilder.AddNode(Inline)
Expand Down Expand Up @@ -6878,6 +6883,7 @@ public void FieldEQAsOfficeMath()
{
//ExStart
//ExFor:FieldEQ
//ExFor:FieldEQ.AsOfficeMath
//ExSummary:Shows how to replace the EQ field with Office Math.
Document doc = new Document(MyDir + "Field sample - EQ.docx");
FieldEQ fieldEQ = doc.Range.Fields.OfType<FieldEQ>().First();
Expand Down Expand Up @@ -7336,6 +7342,7 @@ public void Legacy()
public void SetFieldIndexFormat()
{
//ExStart
//ExFor:FieldIndexFormat
//ExFor:FieldOptions.FieldIndexFormat
//ExSummary:Shows how to formatting FieldIndex fields.
Document doc = new Document();
Expand Down Expand Up @@ -7363,6 +7370,8 @@ public void SetFieldIndexFormat()
//ExFor:ComparisonExpression.ComparisonOperator
//ExFor:ComparisonExpression.RightExpression
//ExFor:FieldOptions.ComparisonExpressionEvaluator
//ExFor:IComparisonExpressionEvaluator
//ExFor:IComparisonExpressionEvaluator.Evaluate(Field,ComparisonExpression)
//ExSummary:Shows how to implement custom evaluation for the IF and COMPARE fields.
[TestCase(" IF {0} {1} {2} \"true argument\" \"false argument\" ", 1, null, "true argument")] //ExSkip
[TestCase(" IF {0} {1} {2} \"true argument\" \"false argument\" ", 0, null, "false argument")] //ExSkip
Expand Down Expand Up @@ -7536,9 +7545,12 @@ public void ComparisonExpressionEvaluatorHeaderFooterFields()
}

//ExStart
//ExFor:FieldOptions.FieldUpdatingCallback
//ExFor:FieldOptions.FieldUpdatingProgressCallback
//ExFor:IFieldUpdatingCallback
//ExFor:IFieldUpdatingProgressCallback
//ExFor:IFieldUpdatingProgressCallback.Notify(FieldUpdatingProgressArgs)
//ExFor:FieldUpdatingProgressArgs
//ExFor:FieldUpdatingProgressArgs.UpdateCompleted
//ExFor:FieldUpdatingProgressArgs.TotalFieldsCount
//ExFor:FieldUpdatingProgressArgs.UpdatedFieldsCount
Expand Down Expand Up @@ -7611,6 +7623,7 @@ public void BibliographySources()
{
//ExStart:BibliographySources
//GistId:eeeec1fbf118e95e7df3f346c91ed726
//ExFor:Document.Bibliography
//ExFor:Bibliography
//ExFor:Bibliography.Sources
//ExFor:Source.Title
Expand Down
2 changes: 2 additions & 0 deletions Examples/ApiExamples/ApiExamples/ExFont.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,8 @@ public void SetFontAutoColor()
//ExStart
//ExFor:Font.Hidden
//ExFor:Paragraph.Accept(DocumentVisitor)
//ExFor:Paragraph.AcceptStart(DocumentVisitor)
//ExFor:Paragraph.AcceptEnd(DocumentVisitor)
//ExFor:DocumentVisitor.VisitParagraphStart(Paragraph)
//ExFor:DocumentVisitor.VisitFormField(FormField)
//ExFor:DocumentVisitor.VisitTableEnd(Table)
Expand Down
Loading

0 comments on commit 87b207b

Please sign in to comment.