diff --git a/Examples/ApiExamples/ApiExamples/ExCharts.cs b/Examples/ApiExamples/ApiExamples/ExCharts.cs index 50ad4b42..39039473 100644 --- a/Examples/ApiExamples/ApiExamples/ExCharts.cs +++ b/Examples/ApiExamples/ApiExamples/ExCharts.cs @@ -2243,5 +2243,60 @@ public void TickLabelsOrientationRotation() doc.Save(ArtifactsDir + "Charts.TickLabelsOrientationRotation.docx"); //ExEnd:TickLabelsOrientationRotation } + + [Test] + public void DoughnutChart() + { + //ExStart:DoughnutChart + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:ChartSeriesGroup.DoughnutHoleSize + //ExFor:ChartSeriesGroup.FirstSliceAngle + //ExSummary:Shows how to create and format Doughnut chart. + Document doc = new Document(); + DocumentBuilder builder = new DocumentBuilder(doc); + + Shape shape = builder.InsertChart(ChartType.Doughnut, 400, 400); + Chart chart = shape.Chart; + // Delete the default generated series. + chart.Series.Clear(); + + string[] categories = new string[] { "Category 1", "Category 2", "Category 3" }; + chart.Series.Add("Series 1", categories, new double[] { 4, 2, 5 }); + + // Format the Doughnut chart. + ChartSeriesGroup seriesGroup = chart.SeriesGroups[0]; + seriesGroup.DoughnutHoleSize = 10; + seriesGroup.FirstSliceAngle = 270; + + doc.Save(ArtifactsDir + "Charts.DoughnutChart.docx"); + //ExEnd:DoughnutChart + } + + [Test] + public void PieOfPieChart() + { + //ExStart:PieOfPieChart + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:ChartSeriesGroup.SecondSectionSize + //ExSummary:Shows how to create and format pie of Pie chart. + Document doc = new Document(); + DocumentBuilder builder = new DocumentBuilder(doc); + + Shape shape = builder.InsertChart(ChartType.PieOfPie, 440, 300); + Chart chart = shape.Chart; + // Delete the default generated series. + chart.Series.Clear(); + + string[] categories = new string[] { "Category 1", "Category 2", "Category 3", "Category 4" }; + chart.Series.Add("Series 1", categories, new double[] { 11, 8, 4, 3 }); + + // Format the Pie of Pie chart. + ChartSeriesGroup seriesGroup = chart.SeriesGroups[0]; + seriesGroup.GapWidth = 10; + seriesGroup.SecondSectionSize = 77; + + doc.Save(ArtifactsDir + "Charts.PieOfPieChart.docx"); + //ExEnd:PieOfPieChart + } } } diff --git a/Examples/ApiExamples/ApiExamples/ExMarkdownSaveOptions.cs b/Examples/ApiExamples/ApiExamples/ExMarkdownSaveOptions.cs index c901545a..960fdd41 100644 --- a/Examples/ApiExamples/ApiExamples/ExMarkdownSaveOptions.cs +++ b/Examples/ApiExamples/ApiExamples/ExMarkdownSaveOptions.cs @@ -245,6 +245,42 @@ public void LinkExportMode() string outDocContents = File.ReadAllText(ArtifactsDir + "MarkdownSaveOptions.LinkExportMode.Inline.md"); Assert.AreEqual("![](MarkdownSaveOptions.LinkExportMode.Inline.001.png)", outDocContents.Trim()); } + + [Test] + public void ExportTableAsHtml() + { + //ExStart:ExportTableAsHtml + //GistId:bb594993b5fe48692541e16f4d354ac2 + //ExFor:MarkdownExportAsHtml + //ExFor:MarkdownSaveOptions.ExportAsHtml + //ExSummary:Shows how to export a table to Markdown as raw HTML. + Document doc = new Document(); + DocumentBuilder builder = new DocumentBuilder(doc); + + builder.Writeln("Sample table:"); + + // Create table. + builder.InsertCell(); + builder.ParagraphFormat.Alignment = ParagraphAlignment.Right; + builder.Write("Cell1"); + builder.InsertCell(); + builder.ParagraphFormat.Alignment = ParagraphAlignment.Center; + builder.Write("Cell2"); + + MarkdownSaveOptions saveOptions = new MarkdownSaveOptions(); + saveOptions.ExportAsHtml = MarkdownExportAsHtml.Tables; + + doc.Save(ArtifactsDir + "MarkdownSaveOptions.ExportTableAsHtml.md", saveOptions); + //ExEnd:ExportTableAsHtml + + string outDocContents = File.ReadAllText(ArtifactsDir + "MarkdownSaveOptions.ExportTableAsHtml.md"); + Assert.AreEqual("Sample table:\r\n
" +
+ " Cell1 " + + " | " +
+ " Cell2 " + + " |