Kidd Wang
Kidd Wang

Reputation: 13

.net New line and sapce character in docx?

My text from DB is like

title &vbCr& "1. conetnt01" &vbCr& "  1.1 sub" &vbCr& "2. content02" &vbCr& "  2.2 sub"

After replaced vbCr to vbCrLf

In docx

title 
1. conetnt01
1.1 sub content
2. content02
2.2 sub

But my expect is

1. conetnt01
  1.1 sub content
2. content02
  2.2 sub

What can I do for this situation?

Finally my solution is below, but the empty in the first line is disappeared.

str = str.Replace("  ", " ")
str = str.Replace(vbLf, vbCrLf)

Upvotes: 0

Views: 109

Answers (1)

[vbCr] return to line beginning: Represents a carriage-return character for print and display functions.

[vbCrLf] similar to pressing Enter: Represents a carriage-return character combined with a linefeed character for print and display functions.

[vbLf] go to next line: Represents a linefeed character for print and display functions.


"keep calm and start coding!"

Upvotes: 0

Related Questions