Skip to content

Commit

Permalink
Merge branch 'master' into ReleasePreparation
Browse files Browse the repository at this point in the history
  • Loading branch information
falleretic committed Mar 12, 2024
2 parents 449afb5 + 1b663c0 commit c775d1f
Show file tree
Hide file tree
Showing 67 changed files with 1,233 additions and 742 deletions.
8 changes: 4 additions & 4 deletions Examples/ApiExamples/ApiExamples/ApiExamples.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspose.BarCode" Version="24.1.0" />
<PackageReference Include="Aspose.Page" Version="24.1.0" />
<PackageReference Include="Aspose.BarCode" Version="24.2.0" />
<PackageReference Include="Aspose.Page" Version="24.2.0" />
<PackageReference Include="Aspose.PDF" Version="24.2.0" />
<PackageReference Include="Aspose.Words" Version="24.2.0" />
<PackageReference Include="Aspose.Words.Shaping.HarfBuzz" Version="24.2.0" />
<PackageReference Include="Aspose.Words" Version="24.3.0" />
<PackageReference Include="Aspose.Words.Shaping.HarfBuzz" Version="24.3.0" />
<PackageReference Include="BouncyCastle.Cryptography" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
Expand Down
4 changes: 2 additions & 2 deletions Examples/ApiExamples/ApiExamples/ExBookmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void Insert()
//ExFor:Bookmark.Name
//ExSummary:Shows how to insert a bookmark.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
DocumentBuilder builder = new DocumentBuilder(doc);

// A valid bookmark has a name, a BookmarkStart, and a BookmarkEnd node.
// Any whitespace in the names of bookmarks will be converted to underscores if we open the saved document with Microsoft Word.
Expand Down Expand Up @@ -251,7 +251,7 @@ public void Remove()
bookmarks.Clear();

// The text that was inside the bookmarks is still present in the document.
Assert.That(bookmarks, Is.Empty);
Assert.AreEqual(0, bookmarks.Count);
Assert.AreEqual("Text inside MyBookmark_1.\r" +
"Text inside MyBookmark_2.\r" +
"Text inside MyBookmark_3.\r" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,13 @@ public void BookmarkLevels()
// Emptying this collection will preserve the bookmarks and put them all on the same outline level.
outlineLevels.Clear();
//ExEnd

}

[Test]
public void UsePdfBookmarkEditorForBookmarkLevels()
{
BookmarkLevels();

PdfBookmarkEditor bookmarkEditor = new PdfBookmarkEditor();
bookmarkEditor.BindPdf(ArtifactsDir + "BookmarksOutlineLevelCollection.BookmarkLevels.pdf");

Expand All @@ -89,7 +95,7 @@ public void BookmarkLevels()
Assert.AreEqual(3, bookmarks.Count);
Assert.AreEqual("Bookmark 1", bookmarks[0].Title);
Assert.AreEqual("Bookmark 2", bookmarks[1].Title);
Assert.AreEqual("Bookmark 3", bookmarks[2].Title);
Assert.AreEqual("Bookmark 3", bookmarks[2].Title);
}
}
}
15 changes: 10 additions & 5 deletions Examples/ApiExamples/ApiExamples/ExBuildingBlocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,16 @@ public void GlossaryDocument()
Document doc = new Document();
GlossaryDocument glossaryDoc = new GlossaryDocument();

glossaryDoc.AppendChild(new BuildingBlock(glossaryDoc) { Name = "Block 1" });
glossaryDoc.AppendChild(new BuildingBlock(glossaryDoc) { Name = "Block 2" });
glossaryDoc.AppendChild(new BuildingBlock(glossaryDoc) { Name = "Block 3" });
glossaryDoc.AppendChild(new BuildingBlock(glossaryDoc) { Name = "Block 4" });
glossaryDoc.AppendChild(new BuildingBlock(glossaryDoc) { Name = "Block 5" });
BuildingBlock child1 = new BuildingBlock(glossaryDoc) { Name = "Block 1" };
glossaryDoc.AppendChild(child1);
BuildingBlock child2 = new BuildingBlock(glossaryDoc) { Name = "Block 2" };
glossaryDoc.AppendChild(child2);
BuildingBlock child3 = new BuildingBlock(glossaryDoc) { Name = "Block 3" };
glossaryDoc.AppendChild(child3);
BuildingBlock child4 = new BuildingBlock(glossaryDoc) { Name = "Block 4" };
glossaryDoc.AppendChild(child4);
BuildingBlock child5 = new BuildingBlock(glossaryDoc) { Name = "Block 5" };
glossaryDoc.AppendChild(child5);

Assert.AreEqual(5, glossaryDoc.BuildingBlocks.Count);

Expand Down
14 changes: 5 additions & 9 deletions Examples/ApiExamples/ApiExamples/ExCertificateHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,13 @@ public void Create()
{
Pkcs12Store pkcs12Store = new Pkcs12StoreBuilder().Build();
pkcs12Store.Load(certStream, "aw".ToCharArray());
IEnumerator enumerator = pkcs12Store.Aliases.GetEnumerator();

while (enumerator.MoveNext())
foreach (string currentAlias in pkcs12Store.Aliases)
{
if (enumerator.Current != null)
if ((currentAlias != null) &&
(pkcs12Store.IsKeyEntry(currentAlias) &&
pkcs12Store.GetKey(currentAlias).Key.IsPrivate))
{
string currentAlias = enumerator.Current.ToString();
if (pkcs12Store.IsKeyEntry(currentAlias) && pkcs12Store.GetKey(currentAlias).Key.IsPrivate)
{
Console.WriteLine($"Valid alias found: {enumerator.Current}");
}
Console.WriteLine($"Valid alias found: {currentAlias}");
}
}
}
Expand Down
50 changes: 49 additions & 1 deletion Examples/ApiExamples/ApiExamples/ExCharts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,54 @@ public void SetNumberFormatToChartAxis()
Assert.AreEqual("#,##0", chart.AxisY.NumberFormat.FormatCode);
}

[TestCase(ChartType.Column)]
[TestCase(ChartType.Line)]
[TestCase(ChartType.Pie)]
[TestCase(ChartType.Bar)]
[TestCase(ChartType.Area)]
public void TestDisplayChartsWithConversion(ChartType chartType)
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.InsertChart(chartType, 500, 300);
Chart chart = shape.Chart;
chart.Series.Clear();

chart.Series.Add("Aspose Test Series",
new[] { "Word", "PDF", "Excel", "GoogleDocs", "Note" },
new double[] { 1900000, 850000, 2100000, 600000, 1500000 });

doc.Save(ArtifactsDir + "Charts.TestDisplayChartsWithConversion.docx");
doc.Save(ArtifactsDir + "Charts.TestDisplayChartsWithConversion.pdf");
}

[Test]
public void Surface3DChart()
{
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

Shape shape = builder.InsertChart(ChartType.Surface3D, 500, 300);
Chart chart = shape.Chart;
chart.Series.Clear();

chart.Series.Add("Aspose Test Series 1",
new string[] { "Word", "PDF", "Excel", "GoogleDocs", "Note" },
new double[] { 1900000, 850000, 2100000, 600000, 1500000 });

chart.Series.Add("Aspose Test Series 2",
new string[] { "Word", "PDF", "Excel", "GoogleDocs", "Note" },
new double[] { 900000, 50000, 1100000, 400000, 2500000 });

chart.Series.Add("Aspose Test Series 3",
new string[] { "Word", "PDF", "Excel", "GoogleDocs", "Note" },
new double[] { 500000, 820000, 1500000, 400000, 100000 });

doc.Save(ArtifactsDir + "Charts.SurfaceChart.docx");
doc.Save(ArtifactsDir + "Charts.SurfaceChart.pdf");
}

[Test]
public void DataLabelsBubbleChart()
{
Expand Down Expand Up @@ -1620,7 +1668,7 @@ public void ResetDataPointFill()
ChartSeries series = shape.Chart.Series[0];
ChartDataPoint dataPoint = series.DataPoints[1];

Assert.IsTrue(dataPoint.Format.IsDefined);
Assert.IsTrue(dataPoint.Format.IsDefined);

dataPoint.Format.SetDefaultFill();

Expand Down
105 changes: 87 additions & 18 deletions Examples/ApiExamples/ApiExamples/ExCompatibilityOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,24 +54,93 @@ public void OptimizeFor()
/// </summary>
private static void PrintCompatibilityOptions(CompatibilityOptions options)
{
for (int i = 1; i >= 0; i--)
{
Console.WriteLine(Convert.ToBoolean(i) ? "\tEnabled options:" : "\tDisabled options:");
SortedSet<string> optionNames = new SortedSet<string>();

foreach (System.ComponentModel.PropertyDescriptor descriptor in System.ComponentModel.TypeDescriptor.GetProperties(options))
{
if (descriptor.PropertyType == Type.GetType("System.Boolean") && i == Convert.ToInt32(descriptor.GetValue(options)))
{
optionNames.Add(descriptor.Name);
}
}

foreach (string s in optionNames)
{
Console.WriteLine($"\t\t{s}");
}
}
IList<string> enabledOptions = new List<string>();
IList<string> disabledOptions = new List<string>();
AddOptionName(options.AdjustLineHeightInTable, "AdjustLineHeightInTable", enabledOptions, disabledOptions);
AddOptionName(options.AlignTablesRowByRow, "AlignTablesRowByRow", enabledOptions, disabledOptions);
AddOptionName(options.AllowSpaceOfSameStyleInTable, "AllowSpaceOfSameStyleInTable", enabledOptions, disabledOptions);
AddOptionName(options.ApplyBreakingRules, "ApplyBreakingRules", enabledOptions, disabledOptions);
AddOptionName(options.AutoSpaceLikeWord95, "AutoSpaceLikeWord95", enabledOptions, disabledOptions);
AddOptionName(options.AutofitToFirstFixedWidthCell, "AutofitToFirstFixedWidthCell", enabledOptions, disabledOptions);
AddOptionName(options.BalanceSingleByteDoubleByteWidth, "BalanceSingleByteDoubleByteWidth", enabledOptions, disabledOptions);
AddOptionName(options.CachedColBalance, "CachedColBalance", enabledOptions, disabledOptions);
AddOptionName(options.ConvMailMergeEsc, "ConvMailMergeEsc", enabledOptions, disabledOptions);
AddOptionName(options.DisableOpenTypeFontFormattingFeatures, "DisableOpenTypeFontFormattingFeatures", enabledOptions, disabledOptions);
AddOptionName(options.DisplayHangulFixedWidth, "DisplayHangulFixedWidth", enabledOptions, disabledOptions);
AddOptionName(options.DoNotAutofitConstrainedTables, "DoNotAutofitConstrainedTables", enabledOptions, disabledOptions);
AddOptionName(options.DoNotBreakConstrainedForcedTable, "DoNotBreakConstrainedForcedTable", enabledOptions, disabledOptions);
AddOptionName(options.DoNotBreakWrappedTables, "DoNotBreakWrappedTables", enabledOptions, disabledOptions);
AddOptionName(options.DoNotExpandShiftReturn, "DoNotExpandShiftReturn", enabledOptions, disabledOptions);
AddOptionName(options.DoNotLeaveBackslashAlone, "DoNotLeaveBackslashAlone", enabledOptions, disabledOptions);
AddOptionName(options.DoNotSnapToGridInCell, "DoNotSnapToGridInCell", enabledOptions, disabledOptions);
AddOptionName(options.DoNotSuppressIndentation, "DoNotSnapToGridInCell", enabledOptions, disabledOptions);
AddOptionName(options.DoNotSuppressParagraphBorders, "DoNotSuppressParagraphBorders", enabledOptions, disabledOptions);
AddOptionName(options.DoNotUseEastAsianBreakRules, "DoNotUseEastAsianBreakRules", enabledOptions, disabledOptions);
AddOptionName(options.DoNotUseHTMLParagraphAutoSpacing, "DoNotUseHTMLParagraphAutoSpacing", enabledOptions, disabledOptions);
AddOptionName(options.DoNotUseIndentAsNumberingTabStop, "DoNotUseIndentAsNumberingTabStop", enabledOptions, disabledOptions);
AddOptionName(options.DoNotVertAlignCellWithSp, "DoNotVertAlignCellWithSp", enabledOptions, disabledOptions);
AddOptionName(options.DoNotVertAlignInTxbx, "DoNotVertAlignInTxbx", enabledOptions, disabledOptions);
AddOptionName(options.DoNotWrapTextWithPunct, "DoNotWrapTextWithPunct", enabledOptions, disabledOptions);
AddOptionName(options.FootnoteLayoutLikeWW8, "FootnoteLayoutLikeWW8", enabledOptions, disabledOptions);
AddOptionName(options.ForgetLastTabAlignment, "ForgetLastTabAlignment", enabledOptions, disabledOptions);
AddOptionName(options.GrowAutofit, "GrowAutofit", enabledOptions, disabledOptions);
AddOptionName(options.LayoutRawTableWidth, "LayoutRawTableWidth", enabledOptions, disabledOptions);
AddOptionName(options.LayoutTableRowsApart, "LayoutTableRowsApart", enabledOptions, disabledOptions);
AddOptionName(options.LineWrapLikeWord6, "LineWrapLikeWord6", enabledOptions, disabledOptions);
AddOptionName(options.MWSmallCaps, "MWSmallCaps", enabledOptions, disabledOptions);
AddOptionName(options.NoColumnBalance, "NoColumnBalance", enabledOptions, disabledOptions);
AddOptionName(options.NoExtraLineSpacing, "NoExtraLineSpacing", enabledOptions, disabledOptions);
AddOptionName(options.NoLeading, "NoLeading", enabledOptions, disabledOptions);
AddOptionName(options.NoSpaceRaiseLower, "NoSpaceRaiseLower", enabledOptions, disabledOptions);
AddOptionName(options.NoTabHangInd, "NoTabHangInd", enabledOptions, disabledOptions);
AddOptionName(options.OverrideTableStyleFontSizeAndJustification, "OverrideTableStyleFontSizeAndJustification", enabledOptions, disabledOptions);
AddOptionName(options.PrintBodyTextBeforeHeader, "PrintBodyTextBeforeHeader", enabledOptions, disabledOptions);
AddOptionName(options.PrintColBlack, "PrintColBlack", enabledOptions, disabledOptions);
AddOptionName(options.SelectFldWithFirstOrLastChar, "SelectFldWithFirstOrLastChar", enabledOptions, disabledOptions);
AddOptionName(options.ShapeLayoutLikeWW8, "ShapeLayoutLikeWW8", enabledOptions, disabledOptions);
AddOptionName(options.ShowBreaksInFrames, "ShowBreaksInFrames", enabledOptions, disabledOptions);
AddOptionName(options.SpaceForUL, "SpaceForUL", enabledOptions, disabledOptions);
AddOptionName(options.SpacingInWholePoints, "SpacingInWholePoints", enabledOptions, disabledOptions);
AddOptionName(options.SplitPgBreakAndParaMark, "SplitPgBreakAndParaMark", enabledOptions, disabledOptions);
AddOptionName(options.SubFontBySize, "SubFontBySize", enabledOptions, disabledOptions);
AddOptionName(options.SuppressBottomSpacing, "SuppressBottomSpacing", enabledOptions, disabledOptions);
AddOptionName(options.SuppressSpBfAfterPgBrk, "SuppressSpBfAfterPgBrk", enabledOptions, disabledOptions);
AddOptionName(options.SuppressSpacingAtTopOfPage, "SuppressSpacingAtTopOfPage", enabledOptions, disabledOptions);
AddOptionName(options.SuppressTopSpacing, "SuppressTopSpacing", enabledOptions, disabledOptions);
AddOptionName(options.SuppressTopSpacingWP, "SuppressTopSpacingWP", enabledOptions, disabledOptions);
AddOptionName(options.SwapBordersFacingPgs, "SwapBordersFacingPgs", enabledOptions, disabledOptions);
AddOptionName(options.SwapInsideAndOutsideForMirrorIndentsAndRelativePositioning, "SwapInsideAndOutsideForMirrorIndentsAndRelativePositioning", enabledOptions, disabledOptions);
AddOptionName(options.TransparentMetafiles, "TransparentMetafiles", enabledOptions, disabledOptions);
AddOptionName(options.TruncateFontHeightsLikeWP6, "TruncateFontHeightsLikeWP6", enabledOptions, disabledOptions);
AddOptionName(options.UICompat97To2003, "UICompat97To2003", enabledOptions, disabledOptions);
AddOptionName(options.UlTrailSpace, "UlTrailSpace", enabledOptions, disabledOptions);
AddOptionName(options.UnderlineTabInNumList, "UnderlineTabInNumList", enabledOptions, disabledOptions);
AddOptionName(options.UseAltKinsokuLineBreakRules, "UseAltKinsokuLineBreakRules", enabledOptions, disabledOptions);
AddOptionName(options.UseAnsiKerningPairs, "UseAnsiKerningPairs", enabledOptions, disabledOptions);
AddOptionName(options.UseFELayout, "UseFELayout", enabledOptions, disabledOptions);
AddOptionName(options.UseNormalStyleForList, "UseNormalStyleForList", enabledOptions, disabledOptions);
AddOptionName(options.UsePrinterMetrics, "UsePrinterMetrics", enabledOptions, disabledOptions);
AddOptionName(options.UseSingleBorderforContiguousCells, "UseSingleBorderforContiguousCells", enabledOptions, disabledOptions);
AddOptionName(options.UseWord2002TableStyleRules, "UseWord2002TableStyleRules", enabledOptions, disabledOptions);
AddOptionName(options.UseWord2010TableStyleRules, "UseWord2010TableStyleRules", enabledOptions, disabledOptions);
AddOptionName(options.UseWord97LineBreakRules, "UseWord97LineBreakRules", enabledOptions, disabledOptions);
AddOptionName(options.WPJustification, "WPJustification", enabledOptions, disabledOptions);
AddOptionName(options.WPSpaceWidth, "WPSpaceWidth", enabledOptions, disabledOptions);
AddOptionName(options.WrapTrailSpaces, "WrapTrailSpaces", enabledOptions, disabledOptions);
Console.WriteLine("\tEnabled options:");
foreach (string optionName in enabledOptions)
Console.WriteLine($"\t\t{optionName}");
Console.WriteLine("\tDisabled options:");
foreach (string optionName in disabledOptions)
Console.WriteLine($"\t\t{optionName}");
}

private static void AddOptionName(Boolean option, String optionName, IList<string> enabledOptions, IList<string> disabledOptions)
{
if (option)
enabledOptions.Add(optionName);
else
disabledOptions.Add(optionName);
}
//ExEnd

Expand Down
Loading

0 comments on commit c775d1f

Please sign in to comment.