We are happy to announce the release of Spire.XLS for Java 4.12.2. This version supports converting excel file to OFD and supports "Subtotal" function. Also, it enhances the conversion from Excel to PDF, Excel to image. In addition, it fixes some known issues such as the "Wrap text" didn't take effect after merging cells. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREXLS-3568 Supports converting excel file to OFD.
Workbook workbook = new Workbook();
workbook.loadFromFile("input.xlsx");
workbook.saveToFile("output.ofd", FileFormat.OFD); 
New feature SPIREXLS-3571 Supports "Subtotal" function.
Workbook workbook = new Workbook();
workbook.loadFromFile(inputFile);
Worksheet sheet = workbook.getWorksheets().get(0);
//Select data range
CellRange range = sheet.getRange().get("A1:B18");
//Subtotal selected data
sheet.subtotal(range, 0, new int[] { 1 }, SubtotalTypes.Sum, true, false, true);
//Save to file.
workbook.saveToFile(outputFile, ExcelVersion.Version2010);
workbook.dispose(); 
Bug SPIREXLS-3413 Fixes the issue that the "Wrap text" didn't take effect after merging cells.
Bug SPIREXLS-3486
SPIREXLS-3545
Fixes the issue that the content format was incorrect when converting excel file to PDF.
Bug SPIREXLS-3564
SPIREXLS-3565
Fixes the issue that the application threw "Unknown char:" error when saving a chart as an image.
Bug SPIREXLS-3566 Fixes the issue that the effect of converting pdf was incorrect after setting "blackAndWhite" as "true".
Bug SPIREXLS-3567 Fixes the issue that the trend line was lost when saving chart as image.
Bug SPIREXLS-3569 Fixes the issue that the chart content format was incorrect when converting excel file to image.
Click the link to download Spire.XLS for Java 4.12.2

We are pleased to announce the release of Spire.Doc 9.12.7. This version enhances the conversion from Word to PDF and HTML to Word. In addition, it fixes the known issue that the page number was incorrect after updating document fields. More details are listed below.

Here is a list of changes made in this release

Category ID Description
Bug SPIREDOC-6666 Fixes the issue that the page number was incorrect after updating document fields
Bug SPIREDOC-6987 Fixes the issue that the paragraph indentation was incorrect when converting word file to PDF.
Bug SPIREDOC-6995 Optimized the time to convert word files to PDF.
Bug SPIREDOC-7104 Fixes the issue that the list numbers were incorrect when converting HTML to Word.
Click the link to download Spire.Doc 9.12.7
More information of Spire.Doc new release or hotfix:

We are happy to announce the release of Spire.XLS 11.12.2. This version supports setting the border of IprstGeomShape, and enhances the conversion from Excel to PDF. In addition, it fixes some known issues such as the effect was incorrect after adding an oval shape to the chart. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New feature SPIREXLS-3560 Supports setting the border of IPrstGeomShape.
IPrstGeomShape triangle = sheet.PrstGeomShapes.AddPrstGeomShape(2, 2, 100, 100, PrstGeomShapeType.Triangle);
triangle.Line.ForeColor = Color.Green; 
Bug SPIREXLS-1334 Fixes the issue that it didn't take effect after setting IsWrapText () for a PivotTable cell.
Bug SPIREXLS-1927 Fixes the issue that the effect was incorrect after adding an oval shape to the chart.
Bug SPIREXLS-2268 Fixes the issue that the errorbar position was incorrect when converting excel file to PDF.
Bug SPIREXLS-3491 Fixes the issue that the font changed when converting excel file to PDF.
Bug SPIREXLS-3498 Fixes the issue that it didn't take effect when using AutoFitRows().
Bug SPIREXLS-3549 Fixes the issue that the text wrap was incorrect when converting excel file to PDF.
Bug SPIREXLS-3550 Fixes the issue that the application threw "System.OutOfMemoryException" when converting excel file to PDF.
Bug SPIREXLS-3554 Fixes the issue that the content format was incorrect when converting excel file to PDF.
Bug SPIREXLS-3555 Fixes the issue that the application threw an exception when converting excel file to PDF.
Bug SPIREXLS-3556 Fixes the issue that the content was lost when converting excel file to PDF.
Bug SPIREXLS-3557 Fixes the issue that the application threw "System.StackOverflowException" when using CalculateAllValue().
Bug SPIREXLS-3562 Fixes the issue that the content of generated xls file was incorrect after using InsertArray() to fill data.
Click the link to download Spire.XLS 11.12.2
More information of Spire.XLS new release or hotfix:
Thursday, 16 December 2021 07:04

Java: Convert Word to PostScript

PostScript is a page description language designed by Adobe in 1984 for the purpose of printing. A file described in PostScript language may contain text, raster/vector graphics and can be printed by any printer that supports PostScript without being opened in an application. In some cases, you might need to convert your Word document to PostScript. This article will show you how to achieve this task programmatically in Java using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

  • Package Manager
<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url>https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>4.11.8</version>
    </dependency>
</dependencies>

Convert Word to PostScript

The following are the steps to convert a Word document to PostScript:

  • Create an instance of Document class.
  • Load a Word document using Document.loadFromFile() method.
  • Save the document to PostScript using Document.saveToFile() method.
  • Java
import com.spire.doc.Document;
import com.spire.doc.FileFormat;

public class ConvertWordToPostScript {
    public static void main(String[] args){
        //Create a Document instance
        Document document= new Document();
        //Load a Word document
        document.loadFromFile("Sample.docx");
        
        //Save the document to PostScript 
        document.saveToFile("ToPostScript.ps", FileFormat.Post_Script);
    }
}

Java: Convert Word to PostScript

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Thursday, 18 November 2021 06:18

Spire.Office for Java 4.11.3 is released

We are excited to announce the release of Spire.Office for Java 4.11.3. This version brings some new features, for instance, Spire.PDF for Java supports converting PDF to images with transparent background; Spire.XLS for Java supports to get the created time and the last saved time of Excel file; Spire.Doc for Java enhances the conversions from Word to PDF/images/HTML, as well as from HTML to Word. Meanwhile, a lot of bugs have been successfully fixed. More details are listed as follow.

Click the link to download Spire.Office for Java 4.11.3:

Here is a list of changes made in this release

Spire.PDF for Java

Category ID Description
New feature SPIREPDF-4734 Supports converting PDF to images with transparent background.
PdfDocument doc = new PdfDocument();
doc.loadFromFile("input.pdf");
doc.getConvertOptions().setPdfToImageOptions(0);
BufferedImage image = doc.saveAsImage(0); 
Bug SPIREPDF-3907 Fixes the issue that the content was truncated when converting PDF to Word
Bug SPIREPDF-4113
SPIREPDF-4638
SPIREPDF-4651
Fixes the issue that the application hanged when converting PDF to images
Bug SPIREPDF-4588
SPIREPDF-4743
Fixes the issue that the application threw NullPointerException
Bug SPIREPDF-4612 Fixes the issue that the format was incorrect after adding text in grid cell
Bug SPIREPDF-4663 Fixes the issue that the size of the images obtained was incorrect
Bug SPIREPDF-4706 Fixes the issue that the application threw "String index out of range: 4" when converting PDF to Word
Bug SPIREPDF-4713 Fixes the issue that the application threw "Value cannot be null" when loading a PDF file
Bug SPIREPDF-4714 Fixes the issue that setting cell newlines did not work
Bug SPIREPDF-4729 Fixes the issue that the application threw "ClassCastException" when merging PDFs
Bug SPIREPDF-4735 Fixes the issue that the content was incorrect after splitting a PDF document
Bug SPIREPDF-4755 Fixes the issue that the application threw "NumberFormatException" when merging PDFs

Spire.XLS for Java

Category ID Description
New feature SPIREXLS-3488 Supports to get the created time and the last saved time of Excel file.
BuiltInDocumentProperties properties1 = workbook.getDocumentProperties();
properties1.getCreatedTime();
properties1.getLastSaveTime();
Bug SPIREXLS-3427 Fixes the issue that the conditional formats did not take effect when converting an Excel file to PDF
Bug SPIREXLS-3444 Fixes the issue that setting PivotTable layout mode to Outline mode did not take effect
Bug SPIREXLS-3445 Fixes the issue that setting diagonal border color did not take effect
Bug SPIREXLS-3484 Fixes the issue that the legend's name was incorrect after loading and saving an Excel file
Bug SPIREXLS-3507 Fixes the issue that the application threw "java.lang.NullPointerException" when converting an Excel file to PDF

Spire.Doc for Java

Category ID Description
Bug SPIREDOC-6646 Fixes the issue that the text overlapped after converting Word to PDF.
Bug SPIREDOC-6664 Fixes the issue that the bookmark was missing after splitting the table cells.
Bug SPIREDOC-6668 Fixes the issue that it didn't get the correct comment content.
Bug SPIREDOC-6675 Fixes the issue that content was missing after replacing text with equations.
Bug SPIREDOC-6698 Fixes the issue that it didn't get the correct paragraph text.
Bug SPIREDOC-6708 Fixes the issue that the table border was missing after comparing two Word documents.
Bug SPIREDOC-6709
SPIREDOC-6716
SPIREDOC-6829
Fixes the issue that the content was incorrect after converting Word to PDF.
Bug SPIREDOC-6717 Fixes the issue that position of the header image was changed after converting Word to PDF.
Bug SPIREDOC-6721 Fixes the issue that the application threw the error "NullPointerException" when converting Word to PDF.
Bug SPIREDOC-6779 Fixes the issue that there was extra text after converting Word to HTML.
Bug SPIREDOC-6796 Fixes the issue that the pagination was incorrect after converting Word to PDF.
Bug SPIREDOC-6799
SPIREDOC-6854
Fixes the issue that the date content was changed after converting Word to PDF.
Bug SPIREDOC-6817 Fixes the issue that the page number position was incorrect after converting Word to PDF.
Bug SPIREDOC-6821 Fixes the issue that the table border was missing after converting HTML to Word.
Bug SPIREDOC-6822 Fixes the issue that the application threw the error "NullPointerException" when getting the comments.
Bug SPIREDOC-6848 Fixes the issue that the application threw the error "IllegalArgumentException" when converting Word to PDF.
Bug SPIREDOC-6855 Fixes the issue that the content was garbled after converting Word to PDF.
Bug SPIREDOC-6857 Fixes the issue that it didn't accept the changes in the footer.
Bug SPIREDOC-6901 Fixes the issue that some images were missing after converting Word to PDF.
Wednesday, 15 December 2021 01:37

Spire.Office 6.12.1 is released

We are excited to announce the release of Spire.Office 6.12.1. This version brings some new features, for example, Spire.PDF supports NET 6.0, as well as supports getting the PDF page where the attachment is located, also supports to adds the methods of decrypting PDFs Meanwhile, a lot of bugs have been successfully fixed. More details are listed as follow.

In this version, the most recent versions of Spire.Doc, Spire.PDF, Spire.XLS, Spire.Presentation, Spire.Email, Spire.DocViewer, Spire.PDFViewer, Spire.Spreadsheet, Spire.OfficeViewer, Spire.DataExport, Spire.Barcode are included.

DLL Versions:

  • Spire.Doc.dll v9.12.3
  • Spire.Pdf.dll v7.12.1
  • Spire.XLS.dll v11.12.0
  • Spire.Email.dll v4.12.1
  • Spire.DocViewer.Forms.dll v6.8.0
  • Spire.PdfViewer.Forms.dll v6.11.1
  • Spire.PdfViewer.Asp.dll v6.11.1
  • Spire.Presentation.dll v6.12.1
  • Spire.Spreadsheet v5.10.0
  • Spire.OfficeViewer.Forms.dll v6.12.1
  • Spire.Barcode.dll v5.9.4
  • Spire.DataExport.dll v4.1.9
  • Spire.DataExport.ResourceMgr.dll v2.1.0
  • Spire.License.dll v1.4.0
Click the link to get the version Spire.Office 6.12.1:
More information of Spire.Office new release or hotfix:
https://www.e-iceblue.com/forum/spire-office-new-release-or-hotfix-t4764.html

Spire.PDF

Category ID Description
New feature SPIREPDF-4762 Supports .NET 6.0
New feature SPIREPDF-4577 Adds the methods of decrypting PDFs.
pdf.Security.DecryptOwnerPassWord(string ownerPassword);
pdf.Security.DecryptUserPassWord();
New feature SPIREPDF-4594 Supports getting the PDF page where the attachment is located.
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(input);
int pageIndex = GetAttachmentPage(doc.Pages, attachmentName);

private int GetAttachmentPage(Spire.Pdf.Widget.PdfPageCollection pageCollection, string fileName)
{
    if (string.IsNullOrEmpty(fileName))
    {
        throw new ArgumentException("fileName is null or empty");
    }
    for (int i = 0; i < pageCollection.Count; i++)
    {
        PdfPageBase page = pageCollection[i];
        for (int j = 0; j < page.AnnotationsWidget.Count; j++)
        {
            Spire.Pdf.Annotations.PdfFileLinkAnnotationWidget pdfFileLinkAnnotationWidget = page.AnnotationsWidget[j] as Spire.Pdf.Annotations.PdfFileLinkAnnotationWidget;
            if (pdfFileLinkAnnotationWidget != null)
            {
                if (fileName.Equals(pdfFileLinkAnnotationWidget.FileName))
                {
                    return i;
                }
            }
        }
    }
    return -1;
}
Bug SPIREPDF-1683
SPIREPDF-4757
Fixes the issue that loading the PDF with the encrypted password failed
Bug SPIREPDF-2412 Fixes the issue that the content of the converted image was incorrect
Bug SPIREPDF-4449 Fixes the issue that the content of the converted XPS was incorrect
Bug SPIREPDF-4578 Fixes the issue that TIFF had a white background in the result PDF when drawing TIFF on PDF page on .NETCore platform
Bug SPIREPDF-4667 Fixes the issue that the content was inconsistent when converting XPS to PDF
Bug SPIREPDF-4759 Fixes the issue that the result PDF size became larger after deleting image
Bug SPIREPDF-4766 Fixes the issue that a blank section appeared on the right side of the converted OFD
Bug SPIREPDF-4768 Fixes the issue that the word containing the hyphen character was incorrect when converting PDF to SVG
Bug SPIREPDF-4779 Fixes the issue that the application threw System.NullReferenceException when converting PDF to images
Bug SPIREPDF-4783 Fixes the issue that the application threw System.NullReferenceException when printing PDF
Bug SPIREPDF-4785 Fixes the issue that setting text highlighting failed

Spire.Doc

Category ID Description
Bug SPIREDOC-6791 Fixes the issue that the content was incorrect when converting HTML to Docx
Bug SPIREDOC-6875 Fixes the issue that the application threw System.IndexOutOfRangeException when converting Word to PDF
Bug SPIREDOC-6905 Fixes the issue that the editable region disappeared when copying content to new Word file
Bug SPIREDOC-6945 Fixes the issue that the content disappeared when converting Word to PDF
Bug SPIREDOC-6990 Fixes the issue that the application threw System.NullReferenceException when converting Word to XPS on Windows10
Bug SPIREDOC-6998 Fixes the issue that the width of table was incorrect when convertingg HTML to Word
Bug SPIREDOC-7063 Fixes the issue that the formula was not displayed correctly when convertingg HTML to Word

We are glad to announce the release of Spire.Doc 9.12.3. This version enhances the conversion from Word to PDF, and fixes some known issues such as the editable region disappeared when copying content to new Word file. More details are listed below.

Here is a list of changes made in this release

Category ID Description
Bug SPIREDOC-6791 Fixes the issue that the content was incorrect when converting HTML to Docx
Bug SPIREDOC-6875 Fixes the issue that the application threw System.IndexOutOfRangeException when converting Word to PDF
Bug SPIREDOC-6905 Fixes the issue that the editable region disappeared when copying content to new Word file
Bug SPIREDOC-6945 Fixes the issue that the content disappeared when converting Word to PDF
Bug SPIREDOC-6990 Fixes the issue that the application threw System.NullReferenceException when converting Word to XPS on Windows10
Bug SPIREDOC-6998 Fixes the issue that the width of table was incorrect when convertingg HTML to Word
Bug SPIREDOC-7063 Fixes the issue that the formula was not displayed correctly when convertingg HTML to Word
Click the link to download Spire.Doc 9.12.3:
More information of Spire.Doc new release or hotfix:

We are pleased to announce the release of Spire.Doc for Java 4.12.7. This version enhances the conversion from Word to PDF, and fixes some known issues such as the time field was not updated when saving .docx format file to .doc format. More details are listed below.

Here is a list of changes made in this release

Category ID Description
Bug SPIREDOC-5323 Fixes the issue that the returned value was incorrect when calling "hasChanges()"
Bug SPIREDOC-6876 Fixes the issue that the content format was incorrect when converting a word document to PDF
Bug SPIREDOC-6950 Fixes the issue that the content format was incorrect when converting a word document to PDF
Bug SPIREDOC-6984 Fixes the issue that the time field was not updated when saving .docx format file to .doc format.
Bug SPIREDOC-7001 Fixes the issue that the number of pages was changed when converting a word document to PDF.
Bug SPIREDOC-7060 Fixes the issue that the application threw "There is no more open element" after replacing the content of bookmarks.
Bug SPIREDOC-7013 Fixes the issue that the obtained bookmark name was incorrect.
Bug SPIREDOC-7028 Fixes the issue that the formulas garbled when converting a word document to PDF.
Bug SPIREDOC-7076 Fixes the issue that the application threw "Unknown char" when appending Html string.
Click the link to download Spire.Doc for Java 4.12.7:

Microsoft Word provides a real-time word counter that counts the number of words in a document when you type. Beyond that, Microsoft Word also counts the number of pages, paragraphs and characters with or without spaces. In this article, you will learn how to programmatically count the number of words or characters in an existing Word document using Spire.Doc for Java.

Install Spire.Doc for Java

First of all, you're required to add the Spire.Doc.jar file as a dependency in your Java program. The JAR file can be downloaded from this link. If you use Maven, you can easily import the JAR file in your application by adding the following code to your project's pom.xml file.

  • Package Manager
<repositories>
    <repository>
        <id>com.e-iceblue</id>
        <name>e-iceblue</name>
        <url> https://repo.e-iceblue.com/nexus/content/groups/public/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>e-iceblue</groupId>
        <artifactId>spire.doc</artifactId>
        <version>4.12.1</version>
    </dependency>
</dependencies>

Count the Number of Words in a Word Document

The detailed steps are as follows:

  • Create a Document instance.
  • Load a sample Word document using Document.loadFromFile() method.
  • Count the number of words using Document.getBuiltinDocumentProperties().getWordCount() method.
  • Count the number of characters without spaces using Document.getBuiltinDocumentProperties().getCharCount() method.
  • Count the number of characters with spaces using Document.getBuiltinDocumentProperties().getCharCountWithSpace() method.
  • Java
import com.spire.doc.*;
public class countWordsNumber {
    public static void main(String[] args) {
        //Create a Document instance
        Document document = new Document();

        //Load a sample Word document
        document.loadFromFile("Demo.docx");

        //Count the number of words
        System.out.println("WordCount: " + document.getBuiltinDocumentProperties().getWordCount());

        //Count the number of characters without spaces
        System.out.println("CharCount: " + document.getBuiltinDocumentProperties().getCharCount());

        //Count the number of characters with spaces
        System.out.println("CharCountWithSpace: " + document.getBuiltinDocumentProperties().getCharCountWithSpace());
    }
}

Java: Count the Number of Words in a Word Document

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Friday, 10 December 2021 03:38

C#/VB.NET: Convert PDF to Linearized

PDF linearization, also known as "Fast Web View", is a way of optimizing PDF files. Ordinarily, users can view a multipage PDF file online only when their web browsers have downloaded all pages from the server. However, if the PDF file is linearized, the browsers can display the first page very quickly even if the full download has not been completed. This article will demonstrate how to convert a PDF to linearized in C# and VB.NET using Spire.PDF for .NET.

Install Spire.PDF for .NET

To begin with, you need to add the DLL files included in the Spire.PDF for.NET package as references in your .NET project. The DLLs files can be either downloaded from this link or installed via NuGet.

  • Package Manager
PM> Install-Package Spire.PDF

Convert PDF to Linearized

The following are the steps to convert a PDF file to linearized:

  • Load a PDF file using PdfToLinearizedPdfConverter class.
  • Convert the file to linearized using PdfToLinearizedPdfConverter.ToLinearizedPdf() method.
  • C#
  • VB.NET
using Spire.Pdf.Conversion;

namespace ConvertPdfToLinearized
{
    class Program
    {
        static void Main(string[] args)
        {
            //Load a PDF file
            PdfToLinearizedPdfConverter converter = new PdfToLinearizedPdfConverter("Sample.pdf");
            //Convert the file to a linearized PDF
            converter.ToLinearizedPdf("Linearized.pdf");
        }
    }
}
Imports Spire.Pdf.Conversion

Namespace ConvertPdfToLinearized
    Friend Class Program
        Private Shared Sub Main(ByVal args As String())
            'Load a PDF file
            Dim converter As PdfToLinearizedPdfConverter = New PdfToLinearizedPdfConverter("Sample.pdf")
            'Convert the file to a linearized PDF
            converter.ToLinearizedPdf("Linearized.pdf")
        End Sub
    End Class
End Namespace

Open the result file in Adobe Acrobat and take a look at the document properties, you can see the value of “Fast Web View” is Yes which means the file is linearized.

C#/VB.NET: Convert PDF to Linearized

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Page 4 of 148