Text shapes alignment

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
kassel_b
Posts: 2
Joined: Fri Feb 12, 2010 9:34 pm

Text shapes alignment

Post by kassel_b »

I've got problem with right alignement for text shapes. Look at my code but I can't find properties to have a right justification of the text in a text shapes. I found something using memory stream for text formating, but with a lot of thinking to have success....

Anyone can help me ?

procedure Invoice_Print_Header(Week : string; doc : integer);
var
b_obj : tdrwbasic;
n_obj : TDrwnotes;
t_obj : TDrwtext;
txt:TRichEdit;
sm: TmemoryStream;
begin


xls.Sheets[0].rows[0].PixelHeight := 150;
b_obj := xls.sheets[0].DrawingObjects.Basics.add;
b_obj.ShapeType := bstRectangle;
b_obj.Col1 := 0;
b_obj.Col2 := 16;
b_obj.row1 := 0;
b_obj.row2 := 1;
b_obj.FillColor := RGBtoTcolor(235,235,221);

t_obj := xls.Sheets[0].DrawingObjects.texts.add;
t_obj.FillColor := RGBtoTcolor(235,235,221);
t_obj.LineColor := RGBtoTcolor(235,235,221);
t_obj.Col1 := 3;
t_obj.Col2 := 6;
t_obj.row1 := 0;
t_obj.row2 := 0;
t_obj.row1offset := 0.05;
t_obj.row2offset := 0.25;

sm := TmemoryStream.Create;
txt := dlg_lib.Form_Lib.RichEdit1;
txt.lines.Text := 'TEXT-TEXT';
txt.SelectAll;
txt.Font.Name := 'AvantGarde Bk BT';
txt.Font.Size := 18;
txt.Font.Style := [fsbold];
txt.Font.Color := clblack;
txt.Alignment := taRightJustify; // NOT WORKING
txt.lines.SaveToStream(sm);
sm.Position :=0;
t_obj.RichTextLoadFromStream(sm);
sm.Free;

end;
Post Reply