We’re pleased to announce the release of Spire.Office 10.12.0. In this version, Spire.Doc supports the "Two Lines in One" function to enhance Word to PDF conversion; Spire.XLS supports customizing export options when converting Excel to Markdown; Spire.Presentation supports compressing images; Spire.PDF supports both horizontal and vertical text alignment. Meanwhile, a series of known issues have been fixed in this update. More details are as follows.
In this version, the most recent versions of Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Barcode, Spire.DocViewer, Spire.PDFViewer, and Spire.Email are included.
DLL Versions:
- Spire.Doc.dll v13.12.6
- Spire.PDF.dll v11.12.7
- Spire.XLS.dll v15.12.2
- Spire.Presentation.dll v10.12.3
- Spire.Barcode.dll v7.5.0
- Spire.Email.dll v6.8.0
- Spire.DocViewer.Forms.dll v8.9.5
- Spire.PdfViewer.Asp.dll v8.2.9
- Spire.PdfViewer.Forms.dll v8.2.9
- Spire.Spreadsheet.dll v7.5.3
- Spire.OfficeViewer.Forms.dll v8.8.1
Here is a list of changes made in this release
Spre.doc
| Category | ID | Description |
| New feature | SPIREDOC-5504 | Supports setting the "Horizontal in Vertical" property of Paragraph text.
Document doc = new Document();
Section section = doc.AddSection();
Spire.Doc.Documents.Paragraph paragraph = section.AddParagraph();
Spire.Doc.Fields.TextRange farEastLayout = paragraph.AppendText("test");
FarEastLayout style = new FarEastLayout();
style.Vertical = true;
farEastLayout.CharacterFormat.FarEastLayout = style;
doc.SaveToFile(outputFile, FileFormat.Docx);
doc.Close();
|
| New feature | SPIREDOC-11073 | Supports copying styles from template documents when converting Markdown to Docx.
//Load template documents with existing styles
Document temple = new Document();
temple.LoadFromFile("temple.docx");
//Load markdown file
Document doc = new Document();
doc = new Document(@"Doc.md");
//Copy styles from template documents
doc.CopyStylesFromTemplate(temple);
//Save
doc.SaveToFile(@"Doc.docx", Spire.Doc.FileFormat.Docx2016);
|
| New feature | – | Supports the "Two Lines in One" function to enhance Word to PDF conversion. |
| New feature | – | Supports retrieving style change revisions.
Document doc = new Document();
doc.LoadFromFile(inputFile);
RevisionInfoCollection revisionInfoCollection = doc.GetRevisionInfos();
StringBuilder sb = new StringBuilder();
foreach (RevisionInfo revisionInfo in revisionInfoCollection)
{
if (revisionInfo.RevisionType == RevisionType.FormatChange)
{
if (revisionInfo.OwnerObject is Spire.Doc.Fields.TextRange)
{
TextRange range = (TextRange)revisionInfo.OwnerObject;
sb.AppendLine("TextRange:" + range.Text + "\r\n");
doc.RevisionsView = RevisionsView.Original;
sb.AppendLine("Original style:" + "isBold:" + range.CharacterFormat.Bold + ";" + "TextColor:" + range.CharacterFormat.TextColor + ";HighlightColor:" + range.CharacterFormat.HighlightColor + ";FontName:" + range.CharacterFormat.FontName + ";UnderlineStyle:" + range.CharacterFormat.UnderlineStyle + "\r\n");
doc.RevisionsView = RevisionsView.Final;
sb.AppendLine("Final style:" + "isBold:" + range.CharacterFormat.Bold + ";" + "TextColor:" + range.CharacterFormat.TextColor + ";HighlightColor:" + range.CharacterFormat.HighlightColor + ";FontName:" + range.CharacterFormat.FontName + ";UnderlineStyle:" + range.CharacterFormat.UnderlineStyle + "\r\n");
}
}
}
File.WriteAllText(outputFile, sb.ToString());
doc.Close();
|
| New feature | SPIREDOC-10448 | Added a CompatibilityOptions property to the Document class for performing compatibility operations on documents.
Document doc = new Document();
doc.CompatibilityOptions.UlTrailSpace = false;
doc.CompatibilityOptions.AdjustLineHeightInTable = true;
doc.CompatibilityOptions.SpaceForUL = true;
doc.CompatibilityOptions.ApplyBreakingRules = true;
doc.CompatibilityOptions.DoNotExpandShiftReturn = false;
doc.CompatibilityOptions.OverrideTableStyleFontSizeAndJustification = false;
doc.CompatibilityOptions.DoNotAutofitConstrainedTables = true;
doc.SaveToFile("outputFile");
|
| New feature | - | Added the CompatibilityOptions class, CompatibilityTypes enumeration, and WordVersion enumeration to the Spire.Doc.Settings namespace.
Document doc = new Document();
doc.LoadFromFile("inputtFile");
Spire.Doc.Settings.CompatibilityOptions options = doc.CompatibilityOptions;
|
| New feature | - | Added the OptimizeForWordVersion() method to the CompatibilityOptions class, enabling document compatibility to be set by specifying a Word version.
Document doc = new Document();
doc.LoadFromFile(inputFile);
// Set properties
doc.CompatibilityOptions.UlTrailSpace = false;
doc.CompatibilityOptions.AdjustLineHeightInTable = true;
doc.CompatibilityOptions.SpaceForUL = true;
doc.CompatibilityOptions.ApplyBreakingRules = true;
doc.CompatibilityOptions.DoNotExpandShiftReturn = false;
doc.CompatibilityOptions.OverrideTableStyleFontSizeAndJustification = false;
doc.CompatibilityOptions.DoNotAutofitConstrainedTables = true;
// Set FileFormat when saving to preserve effects
doc.SaveToFile(outputFile_after, FileFormat.Docx2016);
// Using version compatibility will reset previously set properties
Spire.Doc.Settings.CompatibilityOptions options = doc.CompatibilityOptions;
doc.CompatibilityOptions.OptimizeForWordVersion(WordVersion.Word2016);
PrintCompatibilityOptions(options, outputFile);
doc.Close();
|
| Bug | SPIREDOC-10859 | Fixed issue with incorrect header appearance when converting Word to PDF. |
| Bug | SPIREDOC-11005 | Fixed issue with loss of image transparency when converting Word to PDF/A-3B. |
| Bug | SPIREDOC-11579 | Fixed issue with incorrect rendering when converting Word to PDF. |
| Bug | SPIREDOC-11623 | Fixed issue where converting Word to PDF threw a "System.NullReferenceException". |
| Bug | SPIREDOC-11644 | Fixed issue with incorrect fonts when converting Word to images. |
| Bug | SPIREDOC-11659 | Fixed issue where copying headers threw an "Object reference not set to an instance of an object" error. |
| Bug | SPIREDOC-11680 | Fixed issue where loading a signed document threw a "System.FormatException" error. |
| Bug | SPIREDOC-11696 | Fixed issue where the doc.HtmlUrlLoadEvent could not be used in the latest version. |
| Bug | SPIREDOC-11700 | Fixed issue with incorrect page number updates in the table of contents. |
| Bug | SPIREDOC-11708 | Fixed the issue where page numbers were incorrect when converting Word documents to PDF. |
Spre.XLS
| Category | ID | Description |
| New Feature | SPIREXLS-5938, SPIREXLS-5975 | Supports customizing export options when converting Excel to Markdown.
Workbook wb = new Workbook();
wb.loadFromFile("input.xlsx");
// Create export options
MarkdownOptions options = new MarkdownOptions();
// Set whether to save images using relative paths
options.setSavePicInRelativePath(true);
// Set whether to format hyperlinks as Markdown reference-style links
options.setSaveHyperlinkAsRef(true);
wb.saveToMarkdown("output.md", options);
|
| Bug | SPIREXLS-6023 | Fixes the issue where adding EMF images to headers caused an exception. |
| Bug | SPIREXLS-6036 | Fixes the issue where the KeepDataType setting failed to preserve original data types. |
| Bug | SPIREXLS-6038 | Fixes the issue where image quality was degraded when converting Excel to PDF. |
| Bug | SPIREXLS-6043 | Fixes the issue where date formulas were calculated incorrectly in French locale. |
| Bug | SPIREXLS-6046 | Fixes the issue where converting HTML to Excel threw an IOException. |
Spire.Presentation
| Category | ID | Description |
| New feature | SPIREPPT-2994 | Added support for compressing images.
Presentation presentation = new Presentation();
presentation.LoadFromFile(inputFile);
foreach (ISlide slide in presentation.Slides)
{
foreach (Spire.Presentation.IShape shape in slide.Shapes)
{
if (shape is SlidePicture)
{
SlidePicture ps = shape as SlidePicture;
// Compress the image: remove cropped areas (true) and set target resolution to 150 DPI (commonly used for web display)
ps.PictureFill.CompressImage(true, 150f);
}
}
}
presentation.SaveToFile(outputFile, FileFormat.Pptx2013);
|
| New feature | SPIREPPT-3004 | Added support for configuring output image DPI when converting slides to images.
presentation.SaveToImage(int pageIndex, int dpiX, int dpiY); |
| Bug | SPIREPPT-3016 | Fixed an issue where bullet points were rendered incorrectly after converting PPTX to PDF. |
| Bug | SPIREPPT-3019 | Fixed an issue where content was clipped after converting PPTX to PDF. |
| Bug | SPIREPPT-3031 | Fixed an issue where slide backgrounds were displayed incorrectly after converting PPTX to PDF. |
| Bug | SPIREPPT-3048 | Fixed an issue that loading a PPTX document threw a “Object reference not set to an instance of an object.” exception. |
Spire.PDF
| Category | ID | Description |
| Adjustment | — | Enhanced the underlying rendering logic for converting PDFs to images on the WPF platform, resulting in significantly improved output image quality. |
| Optimization | SPIREPDF-7855 | Optimized slow web printing requests in the .NET Standard DLL. |
| New feature | SPIREPDF-7826 | Deprecated the PdfFreeTextAnnotation.TextAlignment property and added the new PdfFreeTextAnnotation.StringFormat property to support horizontal and vertical text alignment.
PdfDocument newPdf = new PdfDocument();
PdfPageBase page = newPdf.Pages.Add();
Spire.Pdf.Graphics.PdfFont font = new PdfFont(PdfFontFamily.Helvetica, 10f);
SizeF textSize = font.MeasureString("sample");
RectangleF rect = new RectangleF(50,50, textSize.Width, textSize.Height);
Spire.Pdf.Annotations.PdfFreeTextAnnotation textAnnotation = new Spire.Pdf.Annotations.PdfFreeTextAnnotation(rect);
textAnnotation.Text = "sample";
textAnnotation.Subject = "subject";
textAnnotation.Font = font;
Spire.Pdf.Annotations.PdfAnnotationBorder border = new Spire.Pdf.Annotations.PdfAnnotationBorder(8);
textAnnotation.Border = border;
textAnnotation.LineEndingStyle = Spire.Pdf.Annotations.PdfLineEndingStyle.None;
textAnnotation.Size = new SizeF(textSize.Width * 1.5F, textSize.Height * 1.5F);
textAnnotation.StringFormat.Alignment = PdfTextAlignment.Center;
textAnnotation.StringFormat.LineAlignment = PdfVerticalAlignment.Middle;
page.Annotations.Add(textAnnotation);
newPdf.SaveToFile(result);
|
| Bug | SPIREPDF-2261 | Fixed the issue where Arabic characters entered into form fields were displayed with incorrect text direction. |
| Bug | SPIREPDF-4834 | Fixed the issue where content became inconsistent when converting XPS to PDF. |
| Bug | SPIREPDF-6712, SPIREPDF-6873 | Fixed the issue where Arabic and Hebrew text rendered incorrectly when converting PDF to PDF/A-3a. |
| Bug | SPIREPDF-7526 | Fixed the issue where text blocks were unnecessarily split into multiple lines during PDF-to-PPTX conversion. |
| Bug | SPIREPDF-7816 | Fixed the issue where removing annotation borders had no effect. |
| Bug | SPIREPDF-7828 | Fixed the issue where a System.Exception was thrown during OFD-to-PDF conversion. |
| Bug | SPIREPDF-7810 | Fixed the issue where converting PDF files with annotations to images threw an “ArgumentException”. |
| Bug | SPIREPDF-7856 | Fixed the issue where converting OFD files to PDF threw a “NullReferenceException”. |
| Bug | SPIREPDF-7858 | Fixed the issue where the .NET Standard DLL printed PDF documents to an incorrect output path when using a virtual printer. |
| Bug | SPIREPDF-7872 | Fixed the issue where converting PDF files to PPTX threw a “Parameter is not valid.” exception. |