We’re pleased to announce the release of Spire.PDF for Java 12.8.1. This update mainly fixes the issues occurred when converting PDF to Word and Markdown. A signature-related issue has been resolved as well. More details are as follows.

Here is a list of changes made in this release

Category ID Description
Bug Fix SPIREPDF-3800 Fixed the issue where adding a signature to a PDF resulted in an invalid certificate.
Bug Fix SPIREPDF-3899 Fixed the issue where converting PDF to Word in flow layout mode produced incorrect results.
Bug Fix SPIREPDF-8058 Fixed the issue where converting HTML to PDF resulted in empty content.
Bug Fix SPIREPDF-8107 Fixed the issue where converting PDF to Markdown resulted in an empty document.
Click the link below to download Spire.PDF for Java 12.8.1:

We're pleased to announce the release of Spire.Doc for C++ 14.7.2. This version adds support for converting Word documents to Excel files, expanding document format conversion capabilities. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature SPIREDOC-11984 Supports Word to Excel conversion.
intrusive_ptr<Document> doc = new Document();
doc->LoadFromFile(inputFile.c_str());
doc->SaveToFile(outputFile.c_str(), FileFormat::XLSX);
doc->Close();
Click the link below to download Spire.Doc for C++ 14.7.2:

We're pleased to announce the release of Spire.XLS for Java 16.7.3. This version supports converting a specified cell range to HTML, embedding checkbox controls in cells, and converting Excel to JSON data. Meanwhile, some issues that occurred when loading Excel documents, copying cell ranges or worksheets, and retrieving the print area have also been successfully fixed. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature SPIREXLS-5934 Adds a new property to control whether to retain frozen rows and columns when converting Excel to HTML, with the default value set to false.
Workbook wb = new Workbook();
wb.loadFromFile(inputFile);
HTMLOptions.Default.isSaveFreezedPanes(true);
wb.saveToFile(outputFile, FileFormat.HTML);
wb.dispose();
New Feature SPIREXLS-5938 Adds the isSavePicInRelativePath property to control whether images are saved using relative paths when converting Excel to Markdown.
Workbook wb = new Workbook();
        wb.loadFromFile(inputFile);
        MarkdownOptions markdownOptions = new MarkdownOptions();
        markdownOptions.isSavePicInRelativePath(true);
        wb.saveToMarkdown(outputFile, markdownOptions);
        wb.dispose();
New Feature SPIREXLS-5948 Adds support for the BYROW and BYCOL functions.
                                sheet.getRange().get("G7").setFormula("=BYROW(B7:F7, LAMBDA(row, AVERAGE(row)))");

                                sheet.getRange().get("B8").setFormula("=BYCOL(B2:B7, LAMBDA(col, AVERAGE(col)))");
New Feature SPIREXLS-5975 Adds the isSaveHyperlinkAsRef property to control whether to save hyperlinks as Markdown reference-style links when converting Excel to Markdown.
Workbook wb = new Workbook();
wb.loadFromFile(inputFile);
MarkdownOptions markdownOptions = new MarkdownOptions();
markdownOptions.isSaveHyperlinkAsRef(true);
wb.saveToMarkdown(outputFile, markdownOptions);
wb.dispose();
New Feature SPIREXLS-5980 Supports converting a specified cell range to HTML.
StringBuilder sb = new StringBuilder();
Workbook workbook = new Workbook();
workbook.loadFromFile(inputFile);

Worksheet sheet = workbook.getWorksheets().get(0);
CellRange cell = sheet.getRange().get("A1:B3");
sb.append(cell.getHtmlString());
New Feature SPIREXLS-5982 Adds support for the XMATCH function.
sheet.getRange().get("C4").setFormula("=XMATCH(\"Lucy\", A2:A5)");
New Feature SPIREXLS-5983 Adds support for swapping rows and columns.
Workbook workbook = new Workbook();
workbook.loadFromFile(inputFile);
Worksheet sheet = workbook.getWorksheets().get(0);

EnumSet<CopyRangeOptions> options = EnumSet.of(CopyRangeOptions.Transpose, CopyRangeOptions.All);
sheet.getRange().get("D1").setText("Transpose A1:C4 to D2:G3:");
sheet.getRange().get("A1:C4").copy(sheet.getRange().get("D2:G3"), options);
sheet.getRange().get("D4").setText("Transpose A1:B5 to D5:");
sheet.getRange().get("A1:B5").copy(sheet.getRange().get("D5"), options);

options = EnumSet.of(CopyRangeOptions.Transpose, CopyRangeOptions.CopyStyles);
sheet.getRange().get("D9").setText("Transpose A10 to D10:");
sheet.getRange().get("A10").copy(sheet.getRange().get("D10"), options);
sheet.getRange().get("D11").setText("Transpose A11:B11 to D12:");
sheet.getRange().get("A11:B11").copy(sheet.getRange().get("D12"), options);

options = EnumSet.of(CopyRangeOptions.Transpose, CopyRangeOptions.CopyConditionalFormats);
sheet.getRange().get("D16").setText("Transpose B17:B20 to D17:");
sheet.getRange().get("B17:B20").copy(sheet.getRange().get("D17"), options);

options = EnumSet.of(CopyRangeOptions.Transpose, CopyRangeOptions.CopyStyles);
sheet.getRange().get("D19").setText("Transpose B17:B20 to D20:");
sheet.getRange().get("B17:B20").copy(sheet.getRange().get("D20"), options);

options = EnumSet.of(CopyRangeOptions.Transpose);
sheet.getRange().get("D22").setText("Transpose B17:B20 to D23:");
sheet.getRange().get("B17:B20").copy(sheet.getRange().get("D23"), options);

workbook.saveToFile(outputFile);

sheet.dispose();
workbook.dispose();
New Feature SPIREXLS-5990 Adds support for embedding checkbox controls in cells and setting their checked states.
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);

XlsRange range = (XlsRange)sheet.getRange().get("A1");
range.insertEmbedCheckBox();
range.setEmbedCheckBoxCheckState(true);

workbook.saveToFile(outputFile);
workbook.dispose();
New Feature SPIREXLS-6020 Adds support for the Data Table (What-If Analysis) feature, covering creation, editing, deletion, summary generation, and consolidation.
Workbook wb = new Workbook();
wb.loadFromFile(inputFile);
Worksheet worksheet = wb.getWorksheets().get(0);
// Access the collection of scenarios in the worksheet
XlsScenarioCollection scenarios = worksheet.getScenarios();
//Initialize list objects with different values for scenarios
List currentChangePercentage_Values = new ArrayList() {{ add(0.23); add(0.8); add(1.1); add(0.5); add(0.35); add(0.2); }};
List increasedChangePercentage_Values = new ArrayList() {{ add(0.45); add(0.56); add(0.9); add(0.5); add(0.58); add(0.43); }};
List decreasedChangePercentage_Values = new ArrayList() {{ add(0.3); add(0.2); add(0.5); add(0.3); add(0.5); add(0.23); }};
List currentQuantity_Values = new ArrayList() {{ add(1500); add(3000); add(5000); add(4000); add(500); add(4000); }};
List increasedQuantity_Values = new ArrayList() {{ add(1000); add(5000); add(4500); add(3900); add(10000); add(8900); }};
List decreasedQuantity_Values = new ArrayList() {{ add(1000); add(2000); add(3000); add(3000); add(300); add(4000); }};
//Add scenarios in the worksheet with different values for the same cells
scenarios.add("Current % of Change", worksheet.getRange().get("F5:F10"), currentChangePercentage_Values);
scenarios.add("Increased % of Change", worksheet.getRange().get("F5:F10"), increasedChangePercentage_Values);
scenarios.add("Decreased % of Change", worksheet.getRange().get("F5:F10"), decreasedChangePercentage_Values);
scenarios.add("Current Quantity", worksheet.getRange().get("D5:D10"), currentQuantity_Values);
scenarios.add("Increased Quantity", worksheet.getRange().get("D5:D10"), increasedQuantity_Values);
scenarios.add("Decreased Quantity", worksheet.getRange().get("D5:D10"), decreasedQuantity_Values);
//Saving the workbook
wb.saveToFile(outputFile, ExcelVersion.Version2013);
wb.dispose();
Workbook wb = new Workbook();
wb.loadFromFile(inputFile);
Worksheet worksheet = wb.getWorksheets().get(0);
// Access the collection of scenarios in the worksheet
XlsScenarioCollection scenarios = worksheet.getScenarios();
XlsScenario scenario1 = scenarios.get(0);
XlsScenario scenario2 = scenarios.get(1);
//Modify the scenario
scenario1.setVariableCells(worksheet.getRange().get("A1:A5"), scenario2.getValues());
CellRange sourceCell = worksheet.getRange().get("B1:B5");
scenario2.setVariableCells(sourceCell, scenario2.getValues());
scenario1.show();
scenario2.show();
//Saving the workbook
wb.saveToFile(outputFile, ExcelVersion.Version2013);
wb.dispose();
Workbook wb = new Workbook();
wb.loadFromFile(inputFile);
Worksheet worksheet = wb.getWorksheets().get(0);
// Access the collection of scenarios in the worksheet
XlsScenarioCollection scenarios = worksheet.getScenarios();
//delete the scenario
scenarios.removeScenarioAt(0);// Delete by index
scenarios.removeScenarioByName("two");// Delete by name
String content = "";
content += "Count:" + scenarios.getCount() + "\n";
content += "ContainsScenario:" + scenarios.containsScenario("two") + "\n";
content += "ContainsScenario:" + scenarios.containsScenario("one") + "\n";
TestUtil.writeAllText(outputFile, content);
//Saving the workbook
wb.dispose();
Workbook wb = new Workbook();
wb.loadFromFile(inputFile);
Worksheet worksheet = wb.getWorksheets().get(0);
// Access the collection of scenarios in the worksheet
XlsScenarioCollection scenarios = worksheet.getScenarios();
//Initialize list objects with different values for scenarios
List currentChangePercentage_Values = new ArrayList() {{ add(0.23); add(0.8); add(1.1); add(0.5); add(0.35); add(0.2); }};
List increasedChangePercentage_Values = new ArrayList() {{ add(0.45); add(0.56); add(0.9); add(0.5); add(0.58); add(0.43); }};
List decreasedChangePercentage_Values = new ArrayList() {{ add(0.3); add(0.2); add(0.5); add(0.3); add(0.5); add(0.23); }};
List currentQuantity_Values = new ArrayList() {{ add(1500); add(3000); add(5000); add(4000); add(500); add(4000); }};
List increasedQuantity_Values = new ArrayList() {{ add(1000); add(5000); add(4500); add(3900); add(10000); add(8900); }};
List decreasedQuantity_Values = new ArrayList() {{ add(1000); add(2000); add(3000); add(3000); add(300); add(4000); }};
//Add scenarios in the worksheet with different values for the same cells
scenarios.add("Current % of Change", worksheet.getRange().get("F5:F10"), currentChangePercentage_Values);
scenarios.add("Increased % of Change", worksheet.getRange().get("F5:F10"), increasedChangePercentage_Values);
scenarios.add("Decreased % of Change", worksheet.getRange().get("F5:F10"), decreasedChangePercentage_Values);
scenarios.add("Current Quantity", worksheet.getRange().get("D5:D10"), currentQuantity_Values);
scenarios.add("Increased Quantity", worksheet.getRange().get("D5:D10"), increasedQuantity_Values);
scenarios.add("Decreased Quantity", worksheet.getRange().get("D5:D10"), decreasedQuantity_Values);
//Create Summary
worksheet.getScenarios().summary(worksheet.getRange().get("L7"));
//Saving the workbook
wb.saveToFile(outputFile, ExcelVersion.Version2013);
wb.dispose();
Workbook wb = new Workbook();
wb.loadFromFile(inputFile);
Worksheet worksheet1 = wb.getWorksheets().get(0);
Worksheet worksheet2 = wb.getWorksheets().get(1);// This sheet contains Scenarios
//Merge the scenario
worksheet1.getScenarios().merge(worksheet2);
//Saving the workbook
wb.saveToFile(outputFile, ExcelVersion.Version2013);
wb.dispose();
New Feature SPIREXLS-6162 Adds support for converting Excel to JSON data.
Workbook workbook = new Workbook();
        workbook.loadFromFile(inputFile);
        workbook.saveToFile(outputFile, FileFormat.Json);
        workbook.dispose();
Bug Fix SPIREXLS-6160 Fixes the issue where an "Invalid cell name" exception was thrown when loading an Excel document.
Bug Fix SPIREXLS-6163 Fixes the issue where extra vertical lines appeared on chart axes when copying a cell range.
Bug Fix SPIREXLS-6166 Fixes the issue where retrieving the print area of an Excel document failed.
Bug Fix SPIREXLS-5940 Fixes the issue where a "System.ArgumentOutOfRangeException" exception was thrown when copying a worksheet containing a Slicer.
Click the link below to download Spire.XLS for Java 16.7.3:

We’re pleased to announce the release of Spire.Presentation 11.7.6. This version adds support for saving macro-enabled files and managing VBA modules, including adding and deleting VBA modules. It also fixes an issue where applying multiple licenses failed to take effect. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature SPIREPPT-660 Added the FileFormat.Pptm enumeration type to support saving macro-enabled files.
New Feature - Added support for adding VBA modules.
Presentation ppt = new Presentation();
// Add VBA project to the document
IVbaProject vbaProject = ppt.VbaProject;
vbaProject.Name = "SampleVBAMacro";
vbaProject.CodePage = 936; // Set encoding to support Chinese characters
IVbaModule vbaModule = vbaProject.Modules.Add("SampleModule", VbaModuleType.Module);
vbaModule.SourceCode = @"
Sub ExampleMacro()
' Declare variables
Dim pptPres As Object
Dim pptSlide As Object
Dim pptShape As Object
' Set reference to the current presentation
Set pptPres = ActivePresentation
' Loop through all slides
Dim i As Integer
For i = 1 To pptPres.Slides.Count
Set pptSlide = pptPres.Slides(i)
' Add a title text box to each slide (msoTextOrientationHorizontal = 1)
Set pptShape = pptSlide.Shapes.AddTextbox(1, 50, 50, 600, 50)
pptShape.TextFrame.TextRange.Text = ""Slide "" & i & "" - Auto-generated by macro""
With pptShape.TextFrame.TextRange.Font
.Bold = -1 ' msoTrue = -1
.Size = 24
.Color.RGB = RGB(0, 102, 204)
End With
Next i
' Display completion message
MsgBox ""Macro execution completed! Processed "" & pptPres.Slides.Count & "" slides."", vbInformation, ""Operation Prompt""
End Sub";
ppt.SaveToFile("result.pptm", FileFormat.Pptm);
ppt.Dispose();
New Feature - Added support for deleting VBA modules.
// Remove module by name
Presentation ppt1 = new Presentation();
ppt1.LoadFromFile(inputFile);
IVbaModule firstModule = ppt1.VbaProject.Modules[0];
sb.AppendLine("[Remove by Name]");
sb.AppendLine("Module Name: " + firstModule.Name);
sb.AppendLine("Module Type: " + firstModule.Type);
sb.AppendLine("Module Count Before Deletion: " + ppt1.VbaProject.Modules.Count);
ppt1.VbaProject.Modules.Remove(firstModule.Name);
sb.AppendLine("Module Count After Deletion: " + ppt1.VbaProject.Modules.Count);
ppt1.SaveToFile("result1.pptm", FileFormat.Pptm);
ppt1.Dispose();
// Remove module by index
Presentation ppt2 = new Presentation();
ppt2.LoadFromFile(inputFile);
sb.AppendLine("[Remove by Index (0)]");
sb.AppendLine("Module Count Before Deletion: " + ppt2.VbaProject.Modules.Count);
ppt2.VbaProject.Modules.RemoveAt(0);
sb.AppendLine("Module Count After Deletion: " + ppt2.VbaProject.Modules.Count);
ppt2.SaveToFile("result2.pptm", FileFormat.Pptm);
ppt2.Dispose();
// Remove module by VbaModule object (cast to specific type)
Presentation ppt3 = new Presentation();
ppt3.LoadFromFile(inputFile);
IVbaModule moduleObj = ppt3.VbaProject.Modules[4];
VbaModule vbaModule = (VbaModule)moduleObj;
sb.AppendLine("[Remove by Object]");
sb.AppendLine("Module Name: " + vbaModule.Name);
sb.AppendLine("Module Type: " + vbaModule.Type);
sb.AppendLine("Module Count Before Deletion: " + ppt3.VbaProject.Modules.Count);
ppt3.VbaProject.Modules.Remove(vbaModule);
sb.AppendLine("Module Count After Deletion: " + ppt3.VbaProject.Modules.Count);
ppt3.SaveToFile("result3.pptm", FileFormat.Pptm);
ppt3.Dispose();
// Clear all modules
Presentation ppt4 = new Presentation();
ppt4.LoadFromFile(inputFile);
sb.AppendLine("[Clear All]");
sb.AppendLine("Module Count Before Deletion: " + ppt4.VbaProject.Modules.Count);
ppt4.VbaProject.Modules.Clear();
sb.AppendLine("Module Count After Deletion: " + ppt4.VbaProject.Modules.Count);
ppt4.SaveToFile("result4.pptm", FileFormat.Pptm);
ppt4.Dispose();
Bug Fix - Fixed an issue where applying multiple licenses failed to take effect.
Click the link below to download Spire.Presentation 11.7.6:

We’re pleased to announce the release of Spire.XLS 16.7.2. This version introduces the new ValidateHeaderFooterLength property to prevent exceptions triggered by overly long header or footer text during Excel-to-PDF conversion. Additionally, several known bugs have been fixed. Further details are outlined below.

Here is a list of changes made in this release

Category ID Description
New Feature SPIREXLS-6161 Added the new ValidateHeaderFooterLength property to prevent the exception triggered by long header or footer text when converting Excel to PDF.
workbook.ConverterSetting.ValidateHeaderFooterLength = false;
Bug Fix - Fixed the issue where applying multiple licenses failed to take effect.
Bug Fix SPIREXLS-6152 Fixed the issue where setting the NumberFormat of a cell failed to take effect.
Bug Fix SPIREXLS-6157 Fixed the issue where images were misaligned when converting Excel to PDF.
Bug Fix SPIREXLS-6158 Fixed the issue where the CalculateAllValue() method returned incorrect formula results.
Bug Fix SPIREXLS-6170 Fixed the issue where page breaks were incorrect when converting Excel to PDF.
Click the link below to download Spire.XLS 16.7.2:
More information of Spire.XLS new release or hotfix:

We're pleased to announce the release of Spire.PDF 12.7.8. This version fixes an issue where an "OFD parsing failed" exception was thrown during the conversion process. It also improves the stability of PDF processing. More details are listed below.

Here is a list of changes made in this release

Category ID Description
Bug Fix - Fixed an issue where applying multiple licenses failed to take effect.
Bug Fix SPIREPDF-8062 Fixed an issue where the print job name was incorrect when sending a PDF to a virtual printer.
Bug Fix SPIREPDF-8089 Fixed an issue where extracted text from PDF pages contained duplicated content.
Bug Fix SPIREPDF-8105 Fixed an issue where an "OFD parsing failed" exception was thrown when converting OFD to PDF.
Click the link below to download Spire.PDF 12.7.8:
More information of Spire.PDF new release or hotfix:

We are pleased to announce the release of Spire.Presentation for Java 11.7.2. This version supports converting PowerPoint to pure HTML format and fixes two issues while converting PowerPoint to PDF. Details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature - Added support for converting PowerPoint to pure HTML format (Note: Some unsupported elements are rendered as SVG).
Presentation ppt = new Presentation();
ppt.loadFromFile(inputFile);
ppt.getSaveToHtmlOption().setPureHtml(true);
ppt.saveToFile(outputFile, FileFormat.HTML);
ppt.dispose();
Bug Fix SPIREPPT-2939 Fixed an issue where images turned white when converting PowerPoint to PDF.
Bug Fix SPIREPPT-3157 Fixed an issue where text line wrapping was incorrect when converting PowerPoint to PDF.
Click the link below to download Spire.Presentation for Java 11.7.2:

We're pleased to announce the release of Spire.XLS 16.7.0. This version successfully fixes the issues where macros were lost when copying worksheets, a spelling error occurred in the enumeration type, and formula calculations returned incorrect values. More details are listed below.

Here is a list of changes made in this release

Category ID Description
Bug Fix - Fixes the issue where macros were lost when copying worksheets.
Bug Fix - Fixes a spelling error in the enumeration type.
Bug Fix - Fixes the issue where formula calculations returned incorrect values.
Click the link below to download Spire.XLS for C++ 16.7.0:

We’re pleased to announce the release of Spire.XLS for Python 16.7.1. This version adds support for Data Simulation Analysis (Scenario Manager), Slicers, and Excel to JSON conversion, expanding data analysis and processing capabilities. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature SPIREXLS-6020 Added support for Data Simulation Analysis (Scenario Manager), including creation, editing, deletion, summary generation, and merging.
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
scenarios = worksheet.Scenarios
currentChangePercentage_Values = [0.23, 0.8, 1.1, 0.5, 0.35, 0.2]
increasedChangePercentage_Values = [0.45, 0.56, 0.9, 0.5, 0.58, 0.43]
decreasedChangePercentage_Values = [0.3, 0.2, 0.5, 0.3, 0.5, 0.23]
currentQuantity_Values = [1500, 3000, 5000, 4000, 500, 4000]
increasedQuantity_Values = [1000, 5000, 4500, 3900, 10000, 8900]
decreasedQuantity_Values = [1000, 2000, 3000, 3000, 300, 4000]
scenarios.Add("Current % of Change", worksheet.Range["F5:F10"], currentChangePercentage_Values)
scenarios.Add("Increased % of Change", worksheet.Range["F5:F10"], increasedChangePercentage_Values)
scenarios.Add("Decreased % of Change", worksheet.Range["F5:F10"], decreasedChangePercentage_Values)
scenarios.Add("Current Quantity", worksheet.Range["D5:D10"], currentQuantity_Values)
scenarios.Add("Increased Quantity", worksheet.Range["D5:D10"], increasedQuantity_Values)
scenarios.Add("Decreased Quantity", worksheet.Range["D5:D10"], decreasedQuantity_Values)
wb.SaveToFile(outputFile, ExcelVersion.Version2013)
wb.Dispose()
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
scenarios = worksheet.Scenarios
currentChangePercentage_Values = [0.23, 0.8, 1.1, 0.5, 0.35, 0.2]
increasedChangePercentage_Values = [0.45, 0.56, 0.9, 0.5, 0.58, 0.43]
decreasedChangePercentage_Values = [0.3, 0.2, 0.5, 0.3, 0.5, 0.23]
currentQuantity_Values = [1500, 3000, 5000, 4000, 500, 4000]
increasedQuantity_Values = [1000, 5000, 4500, 3900, 10000, 8900]
decreasedQuantity_Values = [1000, 2000, 3000, 3000, 300, 4000]
scenarios.Add("Current % of Change", worksheet.Range["F5:F10"], currentChangePercentage_Values)
scenarios.Add("Increased % of Change", worksheet.Range["F5:F10"], increasedChangePercentage_Values)
scenarios.Add("Decreased % of Change", worksheet.Range["F5:F10"], decreasedChangePercentage_Values)
scenarios.Add("Current Quantity", worksheet.Range["D5:D10"], currentQuantity_Values)
scenarios.Add("Increased Quantity", worksheet.Range["D5:D10"], increasedQuantity_Values)
scenarios.Add("Decreased Quantity", worksheet.Range["D5:D10"], decreasedQuantity_Values)
worksheet.Scenarios.Summary(worksheet.Range["L7"])
wb.SaveToFile(outputFile, ExcelVersion.Version2013)
wb.Dispose()
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
scenarios = worksheet.Scenarios
scenario1 = scenarios[0]
scenario2 = scenarios[1]
scenario1.SetVariableCells(worksheet.Range["A1:A5"], scenario2.Values)
sourceCell = worksheet.Range["B1:B5"]
scenario2.SetVariableCells(sourceCell, scenario2.Values)
scenario1.Show()
scenario2.Show()
self.get_content(scenario1, outputFile_TXT)
wb.SaveToFile(outputFile, ExcelVersion.Version2013)
wb.Dispose()
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
scenarios = worksheet.Scenarios
scenarios.RemoveScenarioAt(0)
scenarios.RemoveScenarioByName("two")
content = ""
content += "Count:" + str(scenarios.Count) + "\n"
content += "ContainsScenario:" + str(scenarios.ContainsScenario("two")) + "\n"
content += "ContainsScenario:" + str(scenarios.ContainsScenario("one")) + "\n"
with open(outputFile, 'w') as f:
f.write(content)
wb.Dispose()
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
scenarios = worksheet.Scenarios
scenarios.RemoveScenarioAt(0)
scenarios.RemoveScenarioByName("two")
content = ""
content += "Count:" + str(scenarios.Count) + "\n"
content += "ContainsScenario:" + str(scenarios.ContainsScenario("two")) + "\n"
content += "ContainsScenario:" + str(scenarios.ContainsScenario("one")) + "\n"
with open(outputFile, 'w') as f:
f.write(content)
wb.Dispose()
New Feature - Added support for adding Slicers using table data.
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
slicers = worksheet.Slicers
table = worksheet.ListObjects.Create("Super Table", worksheet.Range["A1:C9"])
count = 3
for type in SlicerStyleType.dict.values():
if isinstance(type, SlicerStyleType):
count += 5
rangeStr = "E" + str(count)
index = slicers.Add(table, rangeStr, 0)
xlsSlicer = slicers[index]
xlsSlicer.Name = "slicers_" + str(count)
xlsSlicer.StyleType = type
wb.SaveToFile(outputFile_xlsx, ExcelVersion.Version2013)
wb.Dispose()
New Feature - Added support for adding Slicers using PivotTable data.
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
pt = sheet.PivotTables[0]
slicers = worksheet.Slicers
index = slicers.Add(pt, "E12", 0)
xlsSlicer = slicers[index]
xlsSlicer.Name = "test_xlsSlicer"
xlsSlicer.Width = 100
xlsSlicer.Height = 120
xlsSlicer.StyleType = SlicerStyleType.SlicerStyleLight2
xlsSlicer.PositionLocked = True
slicerCache = xlsSlicer.SlicerCache
slicerCache.CrossFilterType = SlicerCacheCrossFilterType.ShowItemsWithNoData
slicerCacheItems = xlsSlicer.SlicerCache.SlicerCacheItems
xlsSlicerCacheItem = slicerCacheItems[0]
xlsSlicerCacheItem.Selected = False
slicers_2 = worksheet.Slicers
r1 = pt.PivotFields["year"]
index_2 = slicers_2.Add(pt, "I12", r1)
xlsSlicer_2 = slicers[index_2]
xlsSlicer_2.RowHeight = 40
xlsSlicer_2.StyleType = SlicerStyleType.SlicerStyleLight3
xlsSlicer_2.PositionLocked = False
slicerCache_2 = xlsSlicer_2.SlicerCache
slicerCache_2.CrossFilterType = SlicerCacheCrossFilterType.ShowItemsWithDataAtTop
slicerCacheItems_2 = xlsSlicer_2.SlicerCache.SlicerCacheItems
xlsSlicerCacheItem_2 = slicerCacheItems_2[1]
xlsSlicerCacheItem_2.Selected = False
pt.CalculateData()
wb.SaveToFile(outputFile_xlsx, ExcelVersion.Version2013)
wb.Dispose()
New Feature - Added support for removing Slicers.
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet_1 = wb.Worksheets[0]
slicers = worksheet_1.Slicers
slicers.RemoveAt(0)
slicer = worksheet_1.Slicers[1]
worksheet_1.Slicers.Remove(slicer)
worksheet_2 = wb.Worksheets[2]
worksheet_2.Slicers.Clear()
wb.SaveToFile(outputFile_xlsx, ExcelVersion.Version2013)
New Feature - Added support for modifying Slicers.
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
slicers = worksheet.Slicers
xlsSlicer = slicers[0]
xlsSlicer.StyleType = SlicerStyleType.SlicerStyleDark4
xlsSlicer.Caption = "Slicer"
xlsSlicer.PositionLocked = True
slicerCacheItems = xlsSlicer.SlicerCache.SlicerCacheItems
xlsSlicerCacheItem = slicerCacheItems[0]
xlsSlicerCacheItem.Selected = False
displayValue = xlsSlicerCacheItem.DisplayValue
slicerCache = xlsSlicer.SlicerCache
slicerCache.CrossFilterType = SlicerCacheCrossFilterType.ShowItemsWithNoData
wb.SaveToFile(outputFile_xlsx, ExcelVersion.Version2013)
New Feature - Added support for retrieving Slicer information.
wb = Workbook()
wb.LoadFromFile(inputFile)
worksheet = wb.Worksheets[0]
slicers = worksheet.Slicers
content = ""
content += "slicers.Count:" + str(slicers.Count) + "\n"
xlsSlicer = slicers[1]
content += "xlsSlicer.Name:" + xlsSlicer.Name + "\n"
content += "xlsSlicer.Caption:" + xlsSlicer.Caption + "\n"
content += "xlsSlicer.NumberOfColumns:" + str(xlsSlicer.NumberOfColumns) + "\n"
content += "xlsSlicer.ColumnWidth:" + str(xlsSlicer.ColumnWidth) + "\n"
content += "xlsSlicer.RowHeight:" + str(xlsSlicer.RowHeight) + "\n"
content += "xlsSlicer.ShowCaption:" + str(xlsSlicer.ShowCaption) + "\n"
content += "xlsSlicer.PositionLocked:" + str(xlsSlicer.PositionLocked) + "\n"
content += "xlsSlicer.Width:" + str(xlsSlicer.Width) + "\n"
content += "xlsSlicer.Height:" + str(xlsSlicer.Height) + "\n"
slicerCache = xlsSlicer.SlicerCache
content += "slicerCache.SourceName:" + slicerCache.SourceName + "\n"
content += "slicerCache.IsTabular:" + str(slicerCache.IsTabular) + "\n"
content += "slicerCache.Name:" + slicerCache.Name + "\n"
slicerCacheItems = slicerCache.SlicerCacheItems
xlsSlicerCacheItem = slicerCacheItems[1]
content += "xlsSlicerCacheItem.Selected:" + str(xlsSlicerCacheItem.Selected) + "\n"
with open(outputFile_T, 'w') as f:
f.write(content)
wb.Dispose()
New Feature SPIREXLS-6162 Added support for converting Excel files to JSON data.
workbook = Workbook()
workbook.LoadFromFile(inputFile)
workbook.SaveToFile(outputFile, FileFormat.Json)
workbook.Dispose()
Click the link below to download Spire.XLS for Python 16.7.1:

We’re pleased to announce the release of Spire.PDF for Python 12.7.0. This version introduces the AutoFontSize property, which enables automatic resizing of text content to fit within a signature field. Additionally, it fixes a font issue that occurred when replacing text. Further details are provided below.

Here is a list of changes made in this release

Category ID Description
New Feature SPIREPDF-7319 Added the AutoFontSize property to support auto-fitting text content to the size of a signature field.
# Initialize a PDF document object
doc = PdfDocument()

# Load the PDF file that needs to be signed
doc.LoadFromFile(inputFile)

# Specify the password for the PFX certificate file
pfxPassword = "e-iceblue"

# Get the first page of the document
page = doc.Pages.get_Item(0)

# Create an ordinary signature maker using the certificate file
signatureMaker = PdfOrdinarySignatureMaker(doc, inputFile_pfx, pfxPassword)

# Set the signature validation layer (False indicates displaying the validity symbol)
signatureMaker.SetAcro6Layers(False)

# Get the signature object and configure the basic information of the signer
signature = signatureMaker.Signature
signature.Name = "Gary"              # Signer's name
signature.ContactInfo = "028-81705109" # Contact information
signature.Location = "Chengdu"       # Signature location
signature.Reason = "The certificate of this document" # Reason for signing

# Create a custom signature appearance object
appearance = PdfSignatureAppearance(signature)
appearance.NameLabel = "Signer: "          # Name label
appearance.ContactInfoLabel = "ContactInfo: " # Contact information label
appearance.LocationLabel = "Location: "    # Location label
appearance.ReasonLabel = "Reaseon: "       # Reason label
appearance.SignatureImage = PdfImage.FromFile(inputFile_image) # Load the signature image
appearance.GraphicMode = GraphicMode.SignImageAndSignDetail # Set to display both the signature image and detailed information
signature.DocumentPermissions = PdfCertificationFlags.ForbidChanges # Set document permissions to forbid changes
appearance.SignImageLayout = SignImageLayout.Stretch # Set the layout mode of the signature image to stretch
appearance.AutoFontSize = True  # Enable auto font size adjustment for text

# Generate and apply the signature at the specified position on the page (Parameters in order: signature field name, page, X coordinate, Y coordinate, width, height, appearance object)
signatureMaker.MakeSignature("signName", page, 54.0, page.Size.Height - 300.0, 40.0, 40.0, appearance)

# Save the signed PDF document
doc.SaveToFile(outputFile)

# Close the document and release resources
doc.Close()
Bug Fix SPIREPDF-8056 Fixed the issue where the font was incorrect after text replacement.
Click the link to download Spire.PDF for Python 12.7.0:
Page 4 of 27