Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Dec 27, 2022 6:12 am

Hello, I have a question.

How-to-Use Formula Inquiries
** It is necessary to guide how to use the formula in general, whether the method is different depending on the type of formula and how to use it for normal output.
Example 1. Conversion using formula. Request to check the part where an error occurs when a field is applied in the place of the expression successful expression
- The part marked in red in the formula (conversion failure) is an expression in which only data is substituted as a field in the actual successful expression
Example 2. Request guidance on how to use the IF formula because it is normally output when only the IF formula is used differently from other formulas
- The method of use differs when comparing IF-Method 1 and IF-Method 2 in the formula (conversion success)

What you have seen in the conversion of formulas to date
1) Currently, only IF, SUM, PRODUCT, and INT are mentioned as examples, but before checking whether errors in other functions occur
2) In the docx file, for example, INT, the data conversion was confirmed to be successful, but the SUM, PRODUCT function could not be calculated and only numbers were listed
3) When converting to a pdf file, it is confirmed that an error appears when a field is included in the formula

The code for use is as follows

Code: Select all

         InputStream is = new ByteArrayInputStream(listStream.get(0).toByteArray());
         
         Document doc = new Document();
         
         doc.insertTextFromStream(is, FileFormat.Docx);
         
         doc.setKeepSameFormat(true);
         
         
         for(int i = 1 ; i < listStream.size() ; i ++) {
            
            is = new ByteArrayInputStream(listStream.get(i).toByteArray());
            
            doc.insertTextFromStream(is, FileFormat.Docx);
            
            doc.getLastSection().setBreakCode(SectionBreakType.New_Page);
            
         }
         
         doc.getLastSection().setBreakCode(SectionBreakType.New_Page);
         
         doc.isUpdateFields(true);

                        if(ExtensionType.DOCX.equals(type)) {
            doc.saveToFile(filePath+type.getCode(), FileFormat.Docx); //docx 파일 저장
         }else {
            ToPdfParameterList ppl = new ToPdfParameterList();
            ppl.isEmbeddedAllFonts(true);
            doc.saveToFile(filePath+type.getCode(), ppl);
            
         }



crizen.solution
 
Posts: 14
Joined: Mon May 30, 2022 12:47 am

Tue Dec 27, 2022 9:53 am

Hello,

Thanks for your inquiry.
For how to use formula, I suggest you can search online help documents for the use of MS Word formulas, due to Spire.Doc follows the specification of MS Word and supports the same formula types and features as MS Word.

According to the follow code you provided, I found that you are loading the existing docx file then using Merge document feature to successively merge multiple documents into one docx document or convert to one Pdf document, right?
Code: Select all
doc.insertTextFromStream(is, FileFormat.Docx);


In addition, for the documents you provided (before.docx、after.docx、after.pdf), do you merge before.docx with other documents to generate after.docx or generate after.pdf? If so, please offer your all input file and output file to help us reproduce your issue and work out a solution for you, you can attach here or send it to us via email (support@e-iceblue.com).

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 844
Joined: Tue Mar 08, 2022 2:02 am

Wed Dec 28, 2022 8:17 am

Hello, thank you for your reply.

The conversion of this file was done by converting a single document without using multiple documents.

Several documents have been merged and used, but for the current problem, only a single file was used.

crizen.solution
 
Posts: 14
Joined: Mon May 30, 2022 12:47 am

Wed Dec 28, 2022 9:49 am

Hello,

Thanks for your feedback.
According to the message you provided, I can’t exactly investigate your issue, to help us reproduce your issue and work out a solution for you, please offer a complete test project, if the project file is too big, you could upload the file to the DropBox or OneDrive and then share the download link with us.

Sincerely
Abel
E-iceblue support team
User avatar

Abel.He
 
Posts: 844
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.Doc