hi ,
i made a little RtfEncapsulator . Its a class thats called RichText ,
it has an RtfElementColle ction which takes any class that exposes the
IRtfElement interface.
I managed to make an RtfTextElement which works really well.
So to add text this has to be done:
Code:
RichText richText = new RichText();
richText.ColorT able.Add(new RtfColor(Color. BlueViolet));
richText.FontTa ble.Add(new RtfFont(Font));
RtfTextElement txt = new RtfTextElement( "Hello??");
txt.IsNewPara = true;
txt.Color = richText.ColorT able[0];
txt.Font = richText.FontTa ble[0];
txt.Alignment = TextAlignment.C entered;
richText.Elemen ts.Add(txt);
But my table element does'nt work very well!
Code:
RtfTableElement table = new RtfTableElement ();
table.ColumnCou nt = 3;
RtfTableRow row = new RtfTableRow();
row.Add(txt); row.Add(new RtfTextElement( "Col2"));
row.Add(new RtfTextElement( "Col3"));
table.Rows.Add( row);
richText.Elemen ts.Add(table);
for one , i just make all the columns 1 inch wide.I want to be able to
set/get *pixel values* for _each_ column , to do that i need DPI to
calculate it , and i need an instance of the graphic class. I planned
to make a internal property for that , but there no generic way to
handle this!??
Also , it seems the .NET RichTextBox does'nt wrap a sentance in a
table cell! Does anyone know the control for that!?? Word and Wordpad
are do it fine.
Heres the source:
http://gidsfiles.googlepages.com/RichTextCore.cs
http://gidsfiles.googlepages.com/RichTextElements.cs
Thanks
Gideon