Carriage return problem

  • Thread starter Thread starter mauro fiore
  • Start date Start date
M

mauro fiore

I wrote (in C#) a program that read the text of a RichTextBox object
and view it in a TextRange.Text of a PowerPoint.Shape.
I have problems when I write a text with 1 or more carriage return.

Ex:
string s = "Hello,\n Merry Christmas";
objShape.TextFrame.TextRange.Text = s;

How can I do to view the two lines inserted previuos ?

Thank's all

Mauro
 
Mauro fiore said:
I wrote (in C#) a program that read the text of a RichTextBox object
and view it in a TextRange.Text of a PowerPoint.Shape.
I have problems when I write a text with 1 or more carriage return.

Ex:
string s = "Hello,\n Merry Christmas";
objShape.TextFrame.TextRange.Text = s;

How can I do to view the two lines inserted previuos ?

What text do you see in the shape after running this?
 
In place of character '\n' I see its symbol (a little square) and the
text isn't being sent to the new line.
Thank you for your intervention

Mauro


Steve Rindsberg ha scritto:
 
Mauro fiore said:
In place of character '\n' I see its symbol (a little square) and the
text isn't being sent to the new line.

Seems that \n becomes a linefeed character, then?

I can repro the same behavior if I append a linefeed to the text:

With oSh.TextFrame.TextRange
.Text = .Text & VbLf & "some more text"
End With

Try a carriage return (ascii 13) or carriage return + linefeed (ascii 10 + ascii
13) instead.
 
I resolved the problem, thank you.
It was enough to replace the text '\n' with '\r\n'.
Albeit I don't understand because the RichTextBox's Text property
return only the '\n' character when I read it.
I hope to learn you soon as I have another problem . For now thank's
again.

Mauro





Steve Rindsberg ha scritto:
 
I resolved the problem, thank you.
It was enough to replace the text '\n' with '\r\n'.
Albeit I don't understand because the RichTextBox's Text property
return only the '\n' character when I read it.
I hope to learn you soon as I have another problem . For now thank's
again.

Glad you got it worked out. You have to expect differences because PowerPoint's tet
boxes are one thing, RichTextBoxes are another.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top