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.

Thu Dec 12, 2019 1:55 pm

[code][/code]
Hello, I have a question. :D

When I want to add a string to Doc, if the string will be more than two lines in Doc, and the string contains a space, the actual text in doc will wrap after that space.

Create a new paragraph object and just call the appendtext function,and the above problems will occur.

liangdada
 
Posts: 3
Joined: Wed Dec 04, 2019 11:26 am

Fri Dec 13, 2019 7:11 am

Hi,

Thanks for your inquiry.
I tested your case with Spire.Doc Pack(hot fix) Version:7.11.1 and got the same result as you mentioned. Below is my code.
Code: Select all
            Document doc = new Document();
            Section sec = doc.AddSection();
            Paragraph pra = sec.AddParagraph();
            pra.AppendText("testssssssssssssssss ttttttttttttttttttttttttttttttttt ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt acgdshfdgahldgbfjbfblfhdhjbjfdgufgdsnfdsnlfhalsuhfdsbjbdufhdiuhbjdfualhd jhiufbgfbidndjduhfdshfljkdhfls");
            doc.SaveToFile("result.docx", FileFormat.Doc);

Kindly note that in MS Word, the word-wrap occurs when the page width is not wide enough to place your long string in one line. And in general, the whole word will be placed in one line. If you try to input a long string(more than two lines and contains a space) in MS Word manually, there will be a word-wrap after the space. We follows the rules of MS Word. I'm afraid we couldn't change the word-wrap rule of MS Word. Hope you could understand.

If I misunderstand, please offer us the following information for further investigation.
1. Your input Word file(if any).
2. Your input long string.
3. The complete code you were using which could reproduce your issue directly.
4. Your desired result file.

You could upload them here or send us(support@e-iceblue.com) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Fri Dec 13, 2019 12:19 pm

Thank you very much for your answer!

I think such a problem may have an inevitable impact on the operation of documents. It's easy for docx documents to have more than one line of statements and spaces in between. How can you make the document more beautiful in operation?
Is there any other way that I can add a long string without wrapping?Call other functions instead of "AppendText"?

liangdada
 
Posts: 3
Joined: Wed Dec 04, 2019 11:26 am

Sun Dec 15, 2019 9:08 am

Amber.Gu wrote:Hi,

Thanks for your inquiry.
I tested your case with Spire.Doc Pack(hot fix) Version:7.11.1[/url] and got the same result as you mentioned. Below is my code.
Code: Select all
            Document doc = new Document();
            Section sec = doc.AddSection();
            Paragraph pra = sec.AddParagraph();
            pra.AppendText("testssssssssssssssss ttttttttttttttttttttttttttttttttt ttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttttt acgdshfdgahldgbfjbfblfhdhjbjfdgufgdsnfdsnlfhalsuhfdsbjbdufhdiuhbjdfualhd jhiufbgfbidndjduhfdshfljkdhfls");
            doc.SaveToFile("result.docx", FileFormat.Doc);

Kindly note that in MS Word, the word-wrap occurs when the page width is not wide enough to place your long string in one line. And in general, the whole word will be placed in one line. If you try to input a long string(more than two lines and contains a space) in MS Word manually, there will be a word-wrap after the space. We follows the rules of MS Word. I'm afraid we couldn't change the word-wrap rule of MS Word. Hope you could understand.

If I misunderstand, please offer us the following information for further investigation.
1. Your input Word file(if any).
2. Your input long string.
3. The complete code you were using which could reproduce your issue directly.
4. Your desired result file.

You could upload them here or send us(support@e-iceblue.com) via email.

Best wishes,
Amber
E-iceblue support team

Thank you very much for your answer!

I think such a problem may have an inevitable impact on the operation of documents. It's easy for docx documents to have more than one line of statements and spaces in between. How can you make the document more beautiful in operation?
Is there any other way that I can add a long string without wrapping?Call other functions instead of "AppendText"?

liangdada
 
Posts: 3
Joined: Wed Dec 04, 2019 11:26 am

Mon Dec 16, 2019 10:32 am

Hi,

Thanks for your reply.
In MS Word, you could set the line break as “Allow Latin text to wrap in the middle of a word” to add a long string without word wrap. And below is the code for you.
Code: Select all
            pra.Format.WordWrap = false;

If the issue still exists, please offer us the following information for further investigation.
1. The complete code you were using which could reproduce your issue directly.
2. Your desired result file.

You could upload them here or send us(support@e-iceblue.com) via email.

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Thu Dec 26, 2019 10:38 am

Hi,

Greetings from E-iceblue.
How's your issue doing? Could you please give us some feedback at your convenience?

Best wishes,
Amber
E-iceblue support team
User avatar

Amber.Gu
 
Posts: 525
Joined: Tue Jun 04, 2019 3:16 am

Return to Spire.Doc