Format and align data in RichTextBox
-
Hi, Can any1 please tell me how to align and format the data appearing in the rtb. I am basically displaying rows in the rtb. Is there any way where in I can have column headers and boundaries like cells in the RTB. Please suggest... Thanks
-
Hi, Can any1 please tell me how to align and format the data appearing in the rtb. I am basically displaying rows in the rtb. Is there any way where in I can have column headers and boundaries like cells in the RTB. Please suggest... Thanks
Hi, AFAIK you can have a real table in RTF files and RTB controls. "All" it takes is this: - create a table in Word - save as RTF file - look at its content, and put something similar into the RichTextBox.Rtf property. I'm not pretending editing a table through an RTB would be easy! :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
Hi, AFAIK you can have a real table in RTF files and RTB controls. "All" it takes is this: - create a table in Word - save as RTF file - look at its content, and put something similar into the RichTextBox.Rtf property. I'm not pretending editing a table through an RTB would be easy! :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
Hi, do u mean to say, I create a Table structure with column headers pertaining to the rows in rtf and save it on the desktop. And then use the rtb.rtf property ? But how do I set the rtb.rtf property to the correct path of the rtf file stored in the desktop./?
-
Hi, do u mean to say, I create a Table structure with column headers pertaining to the rows in rtf and save it on the desktop. And then use the rtb.rtf property ? But how do I set the rtb.rtf property to the correct path of the rtf file stored in the desktop./?
No. I didn't say desktop, nor path. All I said is test with Word->RTF file->RTF property. Use some dumb editor (NotePad) to get the RTF file content and assign it to RTB.Rtf property. Look at the RTF code, modify it as needed. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
-
No. I didn't say desktop, nor path. All I said is test with Word->RTF file->RTF property. Use some dumb editor (NotePad) to get the RTF file content and assign it to RTB.Rtf property. Look at the RTF code, modify it as needed. :)
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
Thanks sir, But i have never done this, can you please send me some web links or code snippets to achieve this task..
-
Thanks sir, But i have never done this, can you please send me some web links or code snippets to achieve this task..
all it takes is a single statement, give this a try:
this.richTextBox1.Rtf=
@"{\rtf1\ansi\deff0{\fonttbl{\f0\froman Arial;}{\f1\froman\fcharset0 Arial;}{\f2\fswiss\fcharset0 Arial;}}"+
@"{\colortbl ;\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;}"+
@"{\*\generator Msftedit 5.41.21.2507;}\viewkind4\uc1\pard\sb60\sa40\cf1\highlight2\lang1033\b\f0\fs28 Ontvangsten in Jul-2009\b0\par"+
@"\fs20\par"+
@"\trowd\trgaph70\trbrdrl\brdrs\brdrw15\brdrcf3 \trbrdrt\brdrs\brdrw15\brdrcf3 \trbrdrr\brdrs\brdrw15\brdrcf3 \trbrdrb\brdrs\brdrw15"+
@"\brdrcf3 \trpaddl70\trpaddr70\trpaddfl3\trpaddfr3"+
@"\clcfpat3\clcbpat3\clshdng10000\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3"+
@"\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx1900\clcfpat3\clcbpat3\clshdng10000\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3"+
@"\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx3400\clcfpat3\clcbpat3\clshdng10000\clbrdrl\brdrw15\brdrs\brdrcf3"+
@"\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx4900\clcfpat3\clcbpat3\clshdng10000"+
@"\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx6700"+
@"\clcfpat3\clcbpat3\clshdng10000\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15"+
@"\brdrs\brdrcf3 \cellx8200\pard\intbl\sb60\sa40\qc\cf2\highlight3\b datum\b0\cell\b contant\b0\cell\b Bancontact\b0\cell\b overschrijvingen\b0"+
@"\cell\b totaal\b0\cell\row\trowd\trgaph70\trbrdrl\brdrs\brdrw15\brdrcf3 \trbrdrt\brdrs\brdrw15\brdrcf3 \trbrdrr\brdrs\brdrw15\brdrcf3 \trbrdrb"+
@"\brdrs\brdrw15\brdrcf3 \trpaddl70\trpaddr70\trpaddfl3\trpaddfr3"+
@"\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs\brdrcf3 "+
@"\cellx1900\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs"+
@"\brdrcf3 \cellx3400\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15"+
@"\brdrs\brdrcf3 \cellx4900\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb"+
@"\brdrw15\brdrs\brdrcf3 \cellx6700\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3"+
@"\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx8200\pard\intbl\sb60\sa40\qr\cf1\highlight2 WO -
all it takes is a single statement, give this a try:
this.richTextBox1.Rtf=
@"{\rtf1\ansi\deff0{\fonttbl{\f0\froman Arial;}{\f1\froman\fcharset0 Arial;}{\f2\fswiss\fcharset0 Arial;}}"+
@"{\colortbl ;\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue255;}"+
@"{\*\generator Msftedit 5.41.21.2507;}\viewkind4\uc1\pard\sb60\sa40\cf1\highlight2\lang1033\b\f0\fs28 Ontvangsten in Jul-2009\b0\par"+
@"\fs20\par"+
@"\trowd\trgaph70\trbrdrl\brdrs\brdrw15\brdrcf3 \trbrdrt\brdrs\brdrw15\brdrcf3 \trbrdrr\brdrs\brdrw15\brdrcf3 \trbrdrb\brdrs\brdrw15"+
@"\brdrcf3 \trpaddl70\trpaddr70\trpaddfl3\trpaddfr3"+
@"\clcfpat3\clcbpat3\clshdng10000\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3"+
@"\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx1900\clcfpat3\clcbpat3\clshdng10000\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3"+
@"\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx3400\clcfpat3\clcbpat3\clshdng10000\clbrdrl\brdrw15\brdrs\brdrcf3"+
@"\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx4900\clcfpat3\clcbpat3\clshdng10000"+
@"\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx6700"+
@"\clcfpat3\clcbpat3\clshdng10000\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15"+
@"\brdrs\brdrcf3 \cellx8200\pard\intbl\sb60\sa40\qc\cf2\highlight3\b datum\b0\cell\b contant\b0\cell\b Bancontact\b0\cell\b overschrijvingen\b0"+
@"\cell\b totaal\b0\cell\row\trowd\trgaph70\trbrdrl\brdrs\brdrw15\brdrcf3 \trbrdrt\brdrs\brdrw15\brdrcf3 \trbrdrr\brdrs\brdrw15\brdrcf3 \trbrdrb"+
@"\brdrs\brdrw15\brdrcf3 \trpaddl70\trpaddr70\trpaddfl3\trpaddfr3"+
@"\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs\brdrcf3 "+
@"\cellx1900\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15\brdrs"+
@"\brdrcf3 \cellx3400\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb\brdrw15"+
@"\brdrs\brdrcf3 \cellx4900\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3\clbrdrb"+
@"\brdrw15\brdrs\brdrcf3 \cellx6700\clbrdrl\brdrw15\brdrs\brdrcf3\clbrdrt\brdrw15\brdrs\brdrcf3\clbrdrr\brdrw15\brdrs\brdrcf3"+
@"\clbrdrb\brdrw15\brdrs\brdrcf3 \cellx8200\pard\intbl\sb60\sa40\qr\cf1\highlight2 WO