News & Releases
|
|

Spire.Office for Java 3.4.0 is released
We're pleased to announce the release of Spire.Office for Java 3.4.0. This version includes some fantastic new features, such as Spire.PDF supports setting the Author/Subject/CreationDate/ModifiedDate of PdfAnnotation, creating PDF launch actions, extracting highlighted text & color and embedding 3D file & sound file, Spire.Presentation supports converting GroupShape to images, setting/getting slide title and setting repeat type of animations, Spire.Doc supports setting diagonal table border and setting gutter, Spire.XLS supports copying cell with style and deleting DataValidation. Meanwhile, a series of issues that occurred when loading, converting and manipulating PDF, PowerPoint, Word and Excel files have been fixed. More details are given below.
Here is a list of changes made in this release
Spire.PDF for Java
| Category | ID | Description |
| Optimization | SPIREPDF-3028 | Optimized the time for the conversion from PDF to Word. |
| New Feature | SPIREPDF-3030 | Supports setting custom width of signature. image/name/detail when signing PDF page.
signing PDF page. signature.setCustomSignPosition(true). signature.setCustomSignImagePosition(x,y,width,height). signature.setCustomSignNamePosition(x,y,width,height) signature.setCustomSignDetailPosition(x,y,width,height). |
| New Feature | SPIREPDF-3076 | Supports setting the Author/Subject/CreationDate/ModifiedDate of PdfAnnotation.
PdfAnnotation. setAuthor(String value); setSubject(String value); setCreationDate(Date value); setModifiedDate(Date value); |
| New Feature | SPIREPDF-3080 | Supports expanding specific bookmarks.
setExpandBookmark(boolean value); |
| New Feature | SPIREPDF-3081 | Supports getting the style of RadioButton field.
PdfRadioButtonListFieldWidget radio = (PdfRadioButtonListFieldWidget)field; //Get the button style PdfCheckBoxStyle buttonStyle = radio.getButtonStyle(); |
| New Feature | SPIREPDF-2981 | Supports creating PDF launch actions.
PdfDocument doc = new PdfDocument();
PdfPageBase page = doc.getPages().add();
//Create a PDF Launch Action
PdfLaunchAction launchAction = new PdfLaunchAction(inputFile);
//Create a PDF Action Annotation with the PDF Launch Action
String text = "Click here to open file";
PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial",0, 13));
Rectangle2D rect = new Rectangle2D.Float(50, 50, 230, 15);
page.getCanvas().drawString(text, font, PdfBrushes.getForestGreen(), rect);
PdfActionAnnotation annotation = new PdfActionAnnotation(rect, launchAction);
//Add the PDF Action Annotation to page
page.getAnnotationsWidget().add(annotation);
//Save the document
doc.saveToFile(outputFile);
|
| New Feature | SPIREPDF-2985 | Supports extracting highlighted text and color.
PdfDocument doc = new PdfDocument();
doc.loadFromFile(inputFile);
FileWriter fw=new FileWriter(outputFile,true);
BufferedWriter bw=new BufferedWriter(fw);
bw.write("Extracted hightlighted text:"+"\n");
PdfPageBase page = doc.getPages().get(0);
for (int i = 0; i < page.getAnnotationsWidget().getCount(); i++)
{
if (page.getAnnotationsWidget().get(i) instanceof PdfTextMarkupAnnotationWidget)
{
PdfTextMarkupAnnotationWidget textMarkupAnnotation = (PdfTextMarkupAnnotationWidget)page.getAnnotationsWidget().get(i);
//Get the highlighted text
bw.write(page.extractText(textMarkupAnnotation.getBounds()));
//Get the highlighted color
PdfRGBColor color = textMarkupAnnotation.getTextMarkupColor();
bw.write("Color="+(color.getR() & 0XFF) +","+(color.getG() & 0XFF)+","+(color.getB() & 0XFF)+"\n");
}
}
|
| New Feature | SPIREPDF-3132 |
Supports getting the destinations of TOC contents. PdfDocument pdf = new PdfDocument(folder + "testTOC.pdf");
//Get the first page
PdfPageBase page = pdf.getPages().get(0);
//Get the annotation collection
PdfDocumentLinkAnnotationWidget link;
PdfDestination destination;
PdfAnnotationCollection annotations = page.getAnnotationsWidget();
for (int i = 0; i < annotations.getCount(); i++)
{
if (annotations.get(i) instanceof PdfDocumentLinkAnnotationWidget)
{
link = (PdfDocumentLinkAnnotationWidget)annotations.get(i);
destination =link.getDestination();
int pageIndex = destination.getPageNumber();
Point2D location = destination.getLocation();
}
}
|
| New Feature | SPIREPDF-2952 | Supports setting dash style of pen.
//Create a pen PdfPen pen = new PdfPen(new PdfRGBColor(Color.red), 3f); //Set dash style pen.setDashStyle(PdfDashStyle.Dash); |
| New Feature | SPIREPDF-2977 |
Supports embedding 3D file. String inputFile = "data/CreatePdf3DAnnotation.u3d";
String outputFile = "output/CreatePdf3DAnnotation.pdf";
//Create a Pdf document.
PdfDocument pdf = new PdfDocument();
//Add a new page.
PdfPageBase page = pdf.getPages().add();
//Draw a rectangle on the page to define the canvas area for the 3D file.
Rectangle rt = new Rectangle(0, 80, 200, 200);
//Initialize a new object of Pdf3DAnnotation, load the .u3d file as 3D annotation.
Pdf3DAnnotation annotation = new Pdf3DAnnotation(rt, inputFile);
annotation.setActivation(new Pdf3DActivation());
annotation.getActivation().setActivationMode(Pdf3DActivationMode.Page_Open);
Pdf3DView View = new Pdf3DView();
View.setBackground(new Pdf3DBackground(new PdfRGBColor(128,0,128)));
View.setViewNodeName("3DAnnotation");
View.setRenderMode(new Pdf3DRendermode(Pdf3DRenderStyle.Solid));
View.setInternalName("3DAnnotation");
View.setLightingScheme(new Pdf3DLighting());
View.getLightingScheme().setStyle(Pdf3DLightingStyle.Day);
//Set the 3D view mode for the annotation.
annotation.getViews().add(View);
//Add the annotation to Pdf.
page.getAnnotationsWidget().add(annotation);
//Save the document
pdf.saveToFile(outputFile);
|
| New Feature | SPIREPDF-2982 |
Supports embedding sound file. String inputFile = "data/EmbedSoundFile.pdf";
String inputFile_1 = "data/Music.wav";
String outputFile = "output/EmbedSoundFile.pdf";
//create a pdf document
PdfDocument doc = new PdfDocument();
//load file from disk
doc.loadFromFile(inputFile);
//get the first page
PdfPageBase page = doc.getPages().get(0);
//create a sound action
PdfSoundAction soundAction = new PdfSoundAction(inputFile_1);
soundAction.getSound().setBits(16);
soundAction.getSound().setChannels(PdfSoundChannels.Stereo);
soundAction.getSound().setEncoding(PdfSoundEncoding.Signed);
soundAction.setVolume(0.8f);
soundAction.setRepeat(true);
// set the sound action to be executed when the PDF document is opened
doc.setAfterOpenAction(soundAction);
//save the document
doc.saveToFile(outputFile);
|
| New Feature | SPIREPDF-3077 | Supports setting page tab order.
PdfPageBase page = pdf.getPages().get(0); page.SetTabOrder(TabOrder.Structure); |
| Bug | SPIREPDF-3052 | Fixes the issue that the signature image was stretched after signing PDF. |
| Bug | SPIREPDF-3079 | Fixes the issue that the application threw an exception "NullPointerException" after adding annotation in PDF. |
| Bug | SPIREPDF-3090 | Fixes the issue that the image size became smaller after drawing the PDF page which contains Pdf button fields that filled with images into a new PDF page. |
| Bug | SPIREPDF-2949 | Fixes the issue that the contents were overlapped when converting PDF to docx. |
| Bug | SPIREPDF-2614 SPIREPDF-2631 SPIREPDF-3166 |
Fixes the issue that it failed to delete images. |
| Bug | SPIREPDF-2969 | Fixes the issue that it failed to get scaling of PDF document. |
Spire.Presentation for Java
| Category | ID | Description |
| New Feature | SPIREPPT-1063 | Supports to convert GroupShape to images.
Presentation ppt = new Presentation();
ppt.loadFromFile(input);
for (int i = 0; i < ppt.getSlides().get(0).getShapes().getCount(); i++){
String fileName = outputPath + "shapeToImage_"+i+".png";
BufferedImage image = ppt.getSlides().get(0).getShapes().saveAsImage(i);
ImageIO.write(image, "PNG", new File(fileName));
}
|
| New Feature | SPIREPPT-1065 | Supports to set/get slide title.
ISlide slide1 = ppt.getSlides().get(0);
String title= slide1.getTitle();
slide1.setTitle("new title");
|
| New Feature | SPIREPPT-1069 | Supports to set text highLighting options.
TextHighLightingOptions options = new TextHighLightingOptions();
options.setWholeWordsOnly(true);
options.setCaseSensitive(true);
shape.getTextFrame().HighLightText("Spire", Color.yellow, options);
|
| New Feature | SPIREPPT-1070 | Supports to set repeat type of animations.
AnimationEffectCollection animations = slide.getTimeline().getMainSequence(); animations.get(0).getTiming().setAnimationRepeatType(AnimationRepeatType.UtilEndOfSlide); |
| New Feature | SPIREPPT-1089 | Supports setting the resolution when converting shapes to images.
Presentation ppt = new Presentation();
ppt.loadFromFile(input);
for (int i = 0; i < ppt.getSlides().get(0).getShapes().getCount(); i++){
String fileName = outputPath + "shapeToImage_demo"+i+".png";
BufferedImage image = ppt.getSlides().get(0).getShapes().saveAsImage(i,300,300);
ImageIO.write(image, "PNG", new File(fileName));
}
|
| New Feature | SPIREPPT-1135 | Supports getting the position of text in the shape.
Presentation ppt = new Presentation(); ppt.loadFromFile(inputFile); IAutoShape shape = (IAutoShape)ppt.getSlides().get(0).getShapes().get(0); Point2D location =shape.getTextFrame().getTextLocation(); String concent = " Coordinates of text in shape: x= " + (location.getX() - shape.getLeft()) + " y= " + (location.getY() - shape.getTop()); System.out.println(concent); |
| Bug | SPIREPPT-1062 SPIREPPT-1068 SPIREPPT-1082 SPIREPPT-1085 |
Fixes the issue that partial content was missing when converting shape to image. |
| Bug | SPIREPPT-1066 SPIREPPT-1081 SPIREPPT-1086 |
Fixes the issue that the application threw NullPointerException when converting shape to image. |
| Bug | SPIREPPT-1084 | Fixes the issue that the application threw an error "Argument width[318] or height[0] cannot be less or equal to zero" when converting shape to image. |
| Bug | SPIREPPT-1071 | Fixes the issue that it failed to open output PPT after setting rotation angle of data label. |
| Bug | SPIREPPT-1072 | Fixes the issue that the application threw an error "Unsupported file format" when loading an ODP document. |
| Bug | SPIREPPT-1074 | Fixes the issue that the formula content was incorrect when converting shape to image. |
| Bug | SPIREPPT-1078 | Fixes the issue that it failed to set gap width of chart series. |
| Bug | SPIREPPT-1094 | Fixes the issue that the chart was not correct when converting PPT to PDF/Word. |
| Bug | SPIREPPT-1098 SPIREPPT-1125 |
Fixes the issue that it failed to add Html content. |
| Bug | SPIREPPT-1110 | Fixes the issue that it failed to set font and color of legend of DOUGHNUT chart. |
| Bug | SPIREPPT-1111 | Fixes the issue that h1 tag bold style was missing after adding HTML. |
| Bug | SPIREPPT-1116 | Fixes the issue that it failed to save document after adding a chart. |
Spire.Doc for Java
| Category | ID | Description |
| New Feature | SPIREDOC-3611 | Supports setting diagonal table border.
Document doc = new Document(); Section section = doc.addSection(); Table oTable = section.addTable(true); section.addParagraph(); oTable.resetCells(10, 3); oTable.getTableFormat().getPaddings().setTop(10); oTable.getTableFormat().getPaddings().setBottom(10); oTable.getTableFormat().setHorizontalAlignment(RowAlignment.Center); oTable.getLastCell().getCellFormat().getBorders().getDiagonalUp().setBorderType(BorderStyle.Single); oTable.getFirstRow().getCells().get(0).getCellFormat().getBorders().getDiagonalDown().setBorderType(BorderStyle.Double); |
| New Feature | SPIREDOC-3970 | Supports setting gutter.
Section section = document.getSections().get(0); section.getPageSetup().setGutter(100f); |
| New Feature | SPIREDOC-4147 | Supports setting the diagonal border of table cell.
table.get(0,0).getCellFormat().getBorders().getDiagonalUp().setBorderType(BorderStyle.Single); table.get(0,0).getCellFormat().getBorders().getDiagonalUp().setColor(Color.blue); table.get(0,0).getCellFormat().getBorders().getDiagonalUp().setLineWidth(0.5f); table.get(0,0).getCellFormat().getBorders().getDiagonalDown().setBorderType(BorderStyle.Single); table.get(0,0).getCellFormat().getBorders().getDiagonalDown().setColor(Color.blue); table.get(0,0).getCellFormat().getBorders().getDiagonalDown().setLineWidth(0.5f); |
| Bug | SPIREDOC-3914 | Fixes the issue that application threw the error"java.lang.AbstractMethodError" when using spire.office.jar and crimson.jar in one project. |
| Bug | SPIREDOC-3918 | Fixes the issue that TOC content was incorrect after updating TOC. |
| Bug | SPIREDOC-3939 | Fixes the issue that application threw StackOverFlow Error when converting Word to SVG. |
| Bug | SPIREDOC-3943 | Fixes the issue that the inserted PDF OLE object could not be opened. |
| Bug | SPIREDOC-3944 | Fixes the issue that the content was incorrect when converting Word to PDF. |
| Bug | SPIREDOC-3948 | Fixes the issue that application threw java.lang.NullPointerException when converting Word to PDF. |
| Bug | SPIREDOC-3950 | Fixes the issue that application threw java.lang.StackOverflowError when converting Word to PDF. |
| Bug | SPIREDOC-3952 | Fixes the issue that application threw java.lang.IllegalStateException when loading docx file. |
| Bug | SPIREDOC-3971 | Fixes the issue that it failed to save file after removing section break. |
| Bug | SPIREDOC-3953 SPIREDOC-4023 SPIREDOC-4136 SPIREDOC-4141 |
Fixes the issue that the application threw the "NullPointerException" when loading Word document. |
| Bug | SPIREDOC-3954 SPIREDOC-4016 |
Fixes the issue that SaveToFile method threw the "ClassCastException" after removing section break. |
| Bug | SPIREDOC-3972 SPIREDOC-3986 SPIREDOC-4022 SPIREDOC-4051 SPIREDOC-4091 |
Fixes the issue that the application threw the exception "Cannot remove because there is no parent" when loading Word document. |
| Bug | SPIREDOC-4007 SPIREDOC-4024 SPIREDOC-4093 |
Fixes the issue that the application threw the exception "No have this value 1062" when loading Word document. |
| Bug | SPIREDOC-4042 | Fixes the issue that the tag could not be recognized as page break after converting XML to Word. |
| Bug | SPIREDOC-4043 SPIREDOC-4097 SPIREDOC-4131 |
Fixes the issue that the application threw the exception "Value was either too large or too small for Int32" when loading Word document. |
| Bug | SPIREDOC-4050 | Fixes the issue that the application threw the exception "This is not a structured storage file" when loading Word document. |
| Bug | SPIREDOC-4104 | Fixes the issue that the application threw the "IndexOutOfBoundsException" when converting Word to PDF. |
| Bug | SPIREDOC-4123 | Fixes the issue that the application threw the exception "com.spire.doc.documents.VerticalOrigin cannot be cast to com.spire.doc.verticalRelation" when loading Word document. |
| Bug | SPIREDOC-4139 | Fixes the issue that SaveToFile method threw "The argument cannot be null or empty string" after removing section break. |
| Bug | SPIREDOC-4142 | Fixes the issue that SaveToFile method threw the "NullPointerException" after clearing formatting of paragraph list. |
| Bug | SPIREDOC-4145 | Fixes the issue that SaveToFile method threw the "Unrecognized image type" after removing section break. |
Spire.XLS for Java
| Category | ID | Description |
| New Feature | SPIREXLS-2082 | Supports copying cell with style.
srcRange.copy(destRange,true,true); |
| New Feature | SPIREXLS-2083 | Make the enumeration GroupByTape and ExpandCollapseFlags public.
worksheet.getRange().get("A1:C1").expandGroup(GroupByType.ByRows,ExpandCollapseFlags.ExpandParent);
|
| New Feature | SPIREXLS-2106 | Supports not showing zero.
worksheet.isDisplayZeros(false); |
| New Feature | SPIREXLS-2104 | Supports deleting DataValidation.
workbook.getWorksheets().get(0).getDVTable().remove(rectangles); |
| New Feature | SPIREXLS-2108 | Supports setting the PrintErrors as NA.
pageSetup.setPrintErrors(PrintErrorsType.NA); |
| New Feature | SPIREXLS-2154 | Supports adding radiobutton and copying combobox, line and radiobutton.
//Add radio button worksheet.getRadioButtons().add(5,5,20,20); //Copy line worksheet.getTypedLines().addCopy(line); //Copy radio button worksheet.getTypedRadioButtons().addCopy(button); //Copy combo box worksheet.getTypedComboBoxes().addCopy(combobox); |
| New Feature | SPIREXLS-2155 | Suppprts converting sheet to CSV and only retain filtered data.
worksheet.saveToFile("CsvFilePath", ";", false);
|
| Bug | SPIREXLS-2088 | Fixes the issue that it failed to find number. |
| Bug | SPIREXLS-2089 | Fixes the issue that the array list was unmatched in insertArrayList method. |
| Bug | SPIREXLS-2091 | Fixes the issue that it failed to get the hyperlink type. |
| Bug | SPIREXLS-2091 | Fixes the issue that the font could not be embedded successfully. |
| Bug | SPIREXLS-2093 | Fixes the issue that the format of added arrow was incorrect. |
| Bug | SPIREXLS-2103 | Fixes the issue that protecting sheet didn't take effect. |
| Bug | SPIREXLS-2105 | Fixes the issue that setting the inner margins of textbox didn't take effect. |
| Bug | SPIREXLS-2100 SPIREXLS-2111 |
Fixes the issue that the application threw an exception when applying markerdesigner. |
| Bug | SPIREXLS-2101 | Fixes the issue that the named range was not added successfully. |
| Bug | SPIREXLS-2107 | Fixes the issue that the application threw an exception when getting the custom document properties. |
| Bug | SPIREXLS-2110 SPIREXLS-2117 |
Fixes the issue that border color of ConditionalFormat didn't display correctly. |
| Bug | SPIREXLS-2158 | Fixes the issue that the application threw an exception when adding DataTable in MarkerDesigner. |
| Bug | SPIREXLS-2166 | Fixes the issue that after adding background image in Pivot table in Excel, the generated Excel prompted an error when opening. |
| Bug | SPIREXLS-2174 | Fixes the issue that the application threw the exception "ArrayIndexOutOfBoundsException" when converting Excel to HTML. |
| Bug | SPIREXLS-2195 | Fixed the issue that first setting the horizontal center alignment of the cell and then setting the vertical center didn't take effect. |
| Bug | SPIREXLS-2174 | Fixes the issue that the application threw the exception "NullPointerException" when converting Excel to PDF on MAC. |