We're pleased to announce the release of Spire.Doc 13.7.9. This version adds several new features, such as support for creating combination charts and setting image compression methods when converting Word to PDF. Besides, it also fixes an issue that header images were distorted during Doc to PDF conversion. More details are listed below.
Here is a list of changes made in this release
| Category | ID | Description |
| New feature | SPIREDOC-9977 SPIREDOC-10012 |
Supports creating combination charts.
Document doc = new Document();
Paragraph paragraph = doc.AddSection().AddParagraph();
Chart chart = paragraph.AppendChart(ChartType.Column, 450, 300).Chart;
//Modify 'Series 3' to a line chart and display it on the secondary axis
chart.ChangeSeriesType("Series 3", ChartSeriesType.Line, true);
Console.WriteLine(chart.Series[2].ChartType);
doc.SaveToFile("ComboChart.docx");
|
| New feature | - | Adds the ‘setDefaultSubstitutionFontName()’ method to specify default substitution fonts.
Document document = new Document();
//Set default replacement font
doc.DefaultSubstitutionFontName = "Arial";
Section sec = doc.AddSection();
Paragraph para = sec.AddParagraph();
TextRange tr = para.AppendText("test");
//The system does not have this font
tr.CharacterFormat.FontName = "Helvetica";
doc.SaveToFile(outputFile, FileFormat.PDF);
doc.Close();
|
| New feature | - | Adds the ‘StructureDocumentTag.RemoveSelfOnly()’ method to remove SDT tags while retaining their contents.
// Process inline structure tags
List<StructureDocumentTagInline> tagInlines = structureTags.getM_tagInlines();
for (int i = 0; i < tagInlines.Count; i++)
{
tagInlines[i].RemoveSelfOnly();
}
// Process other structure tags
List<StructureDocumentTag> tags = structureTags.getM_tags();
for (int i = 0; i < tags.Count; i++)
{
tags[i].RemoveSelfOnly();
}
// Process StructureDocumentTagRow
List<StructureDocumentTagRow> rowtags = structureTags.getM_rowtags();
for (int i = 0; i < rowtags.Count; i++)
{
rowtags[i].RemoveSelfOnly();
}
// Process StructureDocumentTagCell
List<StructureDocumentTagCell> celltags = structureTags.getM_celltags();
for (int i = 0; i < celltags.Count; i++)
{
celltags[i].RemoveSelfOnly();
}
|
| New feature | - | Supports setting image compression methods when converting Word to PDF.
Document document = new Document(); document.LoadFromFile(@"Sample.docx"); ToPdfParameterList para = new ToPdfParameterList(); para.PdfImageCompression = Spire.Doc.Export.PdfImageCompression.Jpeg; document.SaveToFile(outputFile,para); |
| New feature | - | Supports inserting formulas into Word documents using OMML code.
Document document = new Document();
Section section = doc.AddSection();
foreach (string ommlCode in OmmlCodes)
{
OfficeMath officeMath = new OfficeMath(doc);
officeMath.CharacterFormat.FontSize = 14f;
officeMath.FromOMMLCode(ommlCode);
section.AddParagraph().ChildObjects.Add(officeMath);
}
doc.SaveToFile(outputFile, FileFormat.Docx2013);
doc.Dispose();
|
| New feature | - | Supports converting math formulas to LaTeX code.
Document document = new Document();
doc.LoadFromFile(inputFile);
StringBuilder stringBuilder = new StringBuilder();
// Iterate through sections in the document
foreach (Section section in doc.Sections)
{
// Iterate through paragraphs in each section
foreach (Paragraph par in section.Body.Paragraphs)
{
// Iterate through child objects in each paragraph
foreach (DocumentObject obj in par.ChildObjects)
{
// Check if the object is an OfficeMath equation
OfficeMath omath = obj as OfficeMath;
if (omath == null) continue;
// Convert OfficeMath equation to LaTex code
string mathml = omath.ToLaTexMathCode();
// Append MathML code to the StringBuilder
stringBuilder.Append("LaTeX code" + mathml);
stringBuilder.Append("\r\n");
}
}
}
// Write the LaTex code to a text file
File.WriteAllText(outputFile, stringBuilder.ToString())
|
| Bug | SPIREDOC-11245 | Fixed an issue where header images were distorted When converting Doc to PDF. |
Click the link to download Spire.Doc 13.7.9:
More information of Spire.Doc new release or hotfix: