We are pleased to announce the release of Spire.Office for Java 11.11.0. In this version, Spire.Doc for Java supports setting Word chart series styles, Spire.XLS for Java adds support for VBA macro management, Spire.PDF for Java fixes issues when used with Tess4J and converting PDF to Word. In addition, several issues that occurred during the conversion and processing of Word/Excel/PDF files have been successfully fixed. More details are listed below.
Click the link to download Spire.Office for Java 11.11.0:
Here is a list of changes made in this release
Spire.Doc for Java
| Category | ID | Description |
| New Feature | SPIREDOC-11882 | Added support for setting chart series styles, including line color, width, line style and fill effects.
Document document = new Document();
document.loadFromFile(inputFile);
Section section = document.getSections().get(0);
for (Paragraph paragraph : (Iterable<? extends Paragraph>) section.getParagraphs()) {
for (int i = 0; i < paragraph.getChildObjects().getCount(); i++) {
if (paragraph.getChildObjects().get(i) instanceof ShapeObject) {
Chart chart = ((ShapeObject) paragraph.getChildObjects().get(i)).getChart();
// 1. Line format: color, width, line style, dash style
Stroke stroke = chart.getSeries().get(0).getDataPoints().getFormat().getStroke();
stroke.getFill().setColor(Color.RED);
stroke.setWeight(2);
stroke.setLineStyle(ShapeLineStyle.Single);
stroke.setDashStyle(DashStyle.Solid);
// 2. Solid fill: fill type, color, transparency
Fill fill = chart.getSeries().get(0).getDataPoints().getFormat().getFill();
fill.setFillType(FillType.Solid);
fill.setColor(Color.BLUE);
fill.setTransparency(0.3);
// 3. Gradient fill: gradient type, direction, angle, gradient stops
Fill gradientFill = chart.getFormat().getFill();
gradientFill.setFillType(FillType.Shade);
gradientFill.setGradientType(GradientFillType.Linear);
gradientFill.setGradientDirection(GradientFillDirection.Linear_Down);
gradientFill.setGradientAngle(90);
gradientFill.getGradientStops().add(new GradientStop(0, Color.WHITE, 1));
gradientFill.getGradientStops().add(new GradientStop(1, Color.BLUE, 0.5));
// 4. Pattern fill: pattern type, foreground color, background color
Fill patternFill = chart.getLegend().getFormat().getFill();
patternFill.setFillType(FillType.Pattern);
patternFill.setPattern(PatternType.Percent_10);
patternFill.setForegroundColor(Color.RED);
patternFill.setBackgroundColor(Color.WHITE);
// 5. Picture/texture fill: image source, transparency, stretch or tile
Fill imageFill = chart.getAxisX().getFormat().getFill();
imageFill.setFillType(FillType.Picture);
imageFill.setImage(imagePath);
imageFill.setImageTransparency(0.5);
imageFill.stretchImage(0, 0, 100, 100);
}
}
}
document.saveToFile(outputFile, FileFormat.Docx);
document.close();
|
| Bug Fix | SPIREDOC-11615 | Fixed the issue where the table of contents was updated incorrectly. |
| Bug Fix | SPIREDOC-12111 | Fixed the issue where footnote and body superscript numbers were positioned too low when converting Word to PDF. |
| Bug Fix | SPIREDOC-12124 SPIREDOC-12125 |
Fixed the issue where converting Word to PDF threw "java.lang.StackOverflowError" exception. |
| Bug Fix | SPIREDOC-12136 | Fixed the issue where converting ODT to PDF threw "java.lang.NullPointerException" exception. |
Spire.XLS for Java
| Category | ID | Description |
| New Feature | - | Supports adding VBA macros.
Workbook workbook = new Workbook();
Workbook workbook = new Workbook();
//Add a VBA project to the document
IVbaProject vbaProject = workbook.getVbaProject();
vbaProject.setName("SampleVBAMacro");
vbaProject.setCodePage(936); //Set the encoding to support Chinese
//Add a module to the VBA project
IVbaModule vbaModule = vbaProject.getModules().add("frmDataEntry", VbaModuleType.UserForm);
workbook.saveToFile(outputFile, FileFormat.Xlsm);
workbook.dispose();
|
| New Feature | - | Supports getting and setting VBA macros.
Workbook wb = new Workbook();
wb.loadFromFile(inputFile);
Worksheet ws = wb.getWorksheets().get(0);
IVbaProject vbaProject = wb.getVbaProject();
// Project properties
vbaProject.setPassword("1234");
vbaProject.setName("modify");
vbaProject.setDescription("Description");
vbaProject.setHelpFileName("image1.png");
vbaProject.setConditionalCompilation("DEBUG = 2");
vbaProject.setLockProjectView(true);
String text = "Password: " + vbaProject.getPassword() + "\n";//The set password can be retrieved
TestUtil.writeAllText(outputFile_TXT, text);
// Sheet properties
IVbaModule mod = vbaProject.getModules().getWorksheetModule(ws);
mod.setName("IVbaModule");
mod.setSourceCode("Dim lRow As Long");
mod.setType(VbaModuleType.Module);
wb.saveToFile(outputFile);
wb.dispose();
|
| New Feature | - | Supports copying VBA macros.
Workbook wb1 = new Workbook();
wb1.loadFromFile(inputFile_1);
IVbaProject vbaProject1 = wb1.getVbaProject();
Workbook wb2 = new Workbook();
wb2.loadFromFile(inputFile_2);
IVbaProject vbaProject2 = wb2.getVbaProject();
Workbook wb3 = new Workbook();
wb3.loadFromFile(inputFile_3);
IVbaProject vbaProject3 = wb3.getVbaProject();
Workbook wb4 = new Workbook();
wb4.loadFromFile(inputFile_4);
IVbaProject vbaProject4 = wb4.getVbaProject();
Workbook dest = new Workbook();
dest.getVbaProject().getModules().add(vbaProject1.getModules().get("SampleModule").clone(dest.getVbaProject().getModules()));
dest.getVbaProject().getModules().add(vbaProject2.getModules().get("Employee").clone(dest.getVbaProject().getModules()));
dest.getVbaProject().getModules().add(vbaProject2.getModules().get(1).clone(dest.getVbaProject().getModules()));
dest.getVbaProject().getModules().add(vbaProject3.getModules().get(0).clone(dest.getVbaProject().getModules()));
dest.getVbaProject().getModules().add(vbaProject4.getModules().get(0).clone(dest.getVbaProject().getModules()));
dest.saveToFile(outputFile);
|
| Bug Fix | - | Fixed the issue where textBox content was lost when converting Excel to PDF and OFD. |
Spire.PDF for Java
| Category | ID | Description |
| Bug Fix | SPIREPDF-8190 | Fixes the issue where an exception was thrown when using the product together with the Tess4J library. |
| Bug Fix | SPIREPDF-8198 | Fixes the issue where text fonts were displayed incorrectly after converting PDF to Word. |