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.

Fri Mar 14, 2014 3:55 pm

Hi, I have an urgent problem.

I created the word file using spire.doc, and it works fine.
I my working solution, the customer will download the file created and open by WPS or word.
So many people use WPS in China, and I can't change their behavior obviously.

The problem is, the WPS can't read the "word file" created by spire.doc correctly, if the file contains tables. So the customer will think the "word file is wrong". WPS could open the file, but the tables in it has big problem:

1) some cells is not in the right place.
Chose these cells, right-click it, and chose "table property", you will see their HorizontalAlignment was set to Right, and their WrapTextAround was set to True, that makes the wrong position. If I change them to Left and False, the cells will be back to their right place.
In the c# code which created the file, I set them to Left and False like this:
Code: Select all
   
   row = table.AddRow()
   row.RowFormat.HorizontalAlignment = RowAlignment.Left
   row.RowFormat.WrapTextAround = False

If you open the file in the "MS-word", you will see they are Left and False,and the cells position is OK.

2) some cells are missing
You will see from the second row, some cells in the cecond columns are missing.

You can down load the result doc file(problem file) here:http://test.kpichina.com.cn/result file(problem file).doc
You can down load the template file here: http://test.kpichina.com.cn/template file.doc
I used in the thread attachment( in c#, I open the template file, and insert table rows, and save to the result doc file with another name).

When you see above, you maybe say, That's the problem of WPS?

But I found if I open the file by "MS word" and save it again(don't change anything, just oepn and save), then the WPS will read the file correctly! The word file created by Spire.Doc is NOT an REAL MS Word File? There must be something different, that make the problem. so that's why I post the problem here, and think we could found what's the diffrent place between the file created by Spire.Doc and the file overwhited by Ms-Word(open and save).

WPS is a popular word file tool in China. If the word file created by Spire.Doc can't be read by WPS, that will make tens of thousands of customers in China can't use Spire.Doc.

Please help me!

yours,
Ivan

ivanchain
 
Posts: 30
Joined: Wed Jan 22, 2014 12:42 am

Mon Mar 17, 2014 5:50 am

Hello,

Thanks for your inquiry.

We do generate the doc based on the "MS word" specifications. As you seen, it diaplays correctly by "MS word". In the word specification defines the default values ​​for certain elements, in order to reduce the size of the document, we don't write these defaults. Maybe the WPS is not compatible with these.
And we have opened the generated doc with the older WPS, it also displays correctly(See screenshot). So it is the problem of WPS, and we recommand that you might transferred the bug to them.

If there are any questions about us, welcome to get it back to us.
Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Mar 19, 2014 5:28 am

Hello, Gary,

Thanks for your quick reply.

I set the row's properties in my c# code, please see the code above. So if I set the property's value, why it still use the "default values" to reduce the size of the document?

Yes, I think you are right, It's the WPS problem to retrieve the word's default table property value in a wrong way. I have transfer the bug report to the WPS.

But if WPS sovled the problem, the tens of thounsands of people who has installed the WPS(problem version) are still can't read the file correctly. I can tell my customer to update their WPS, but I can't tell everyone to do so. So updating WPS will resolve my problem in deed. But the huge amount of WPS users still can't read the file created by Spire.doc. That's not only about me, it's about Spire.Doc. Yes, it's not your fault, but it affects your customers.

Could you give a tip to avoid this by doing something in c# code?
As you said, it use the default values to reduce the size of the document. So if I set the property value from the default one, to the value I wanted, it will remove the problem?


yours,
Ivan

ivanchain
 
Posts: 30
Joined: Wed Jan 22, 2014 12:42 am

Wed Mar 19, 2014 6:55 am

Hello Ivan,

There is a solution that save the result as a .docx document if you can you could try at present, I test it and I think it is available, and I believe huge amount of WPS users could open the .docx document, so maybe it would be also a good way for you to avoid the issue.
As you know, it is other product(WPS), we couldn't check their source codes to change our codes to achieve mutually compatible. And it displays correctly in "MS-word".
Hope you can understand.

Thanks And Regards,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Thu May 01, 2014 2:40 pm

sorry for my late response.
I tested your suggustion, using the spire.doc to create a file in docx format.
Unfortunately, the WPS newest version (2013抢鲜版) still can't read it. The problem is the same.

Could you give me a tip how to save the file as an default doc format, not omitting anything to save the space?

yours,
Ivan

ivanchain
 
Posts: 30
Joined: Wed Jan 22, 2014 12:42 am

Fri May 02, 2014 4:22 am

Hello,

Thanks for your feedback.
We need to communicate with our dev team about your requirement. We have a holiday from May 1 to May 3 here.
We will give you an update at once when we come back to our office. Sorry for the inconvenience. Thanks for your understanding.

Best wishes,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Mon May 05, 2014 3:56 am

Hello,

Sorry for late reply as weekend.
I tested again and saved it docx format with the newest Spire.Doc Standard Edition5.1, then open it with WPS2013抢鲜版, but there is no any space, there are some code I test as below and the result is attachment, you can check it.
Code: Select all
Document doc = new Document();
doc.LoadFromFile("template file.doc");
var table = doc.Sections[0].Tables[0];
for (int i = 0; i < 19;i++ )
            {
                var row = table.AddRow();
                row.RowFormat.HorizontalAlignment = RowAlignment.Left;
                row.RowFormat.WrapTextAround = false;
                for(int j=0;j<row.Cells.Count;j++)
                {
                    row.Cells[j].AddParagraph().AppendPicture(Image.FromFile("test.png"));
                }
            }
doc.SaveToFile("resultwps.docx",FileFormat.Docx);

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Mon May 12, 2014 9:47 am

Yes, I use 5.1 version, the problem is gone(with doc, the problem is still there)

yours,
Ivan

ivanchain
 
Posts: 30
Joined: Wed Jan 22, 2014 12:42 am

Tue May 13, 2014 7:55 am

Thanks for your feedback. But the problem with doc, sorry that there is no any way to make our product compatible with the WPS as we said before.
If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.Doc

cron