1.選擇設置對齊
RichEdit1.SelectAll;
RichEdit1.Paragraph.Alignment:=taLeftJustify; // switch for other alignments
RichEdit1.SelLength:=0;
2.設置對齊和內容
redt1.Clear;
redt1.Lines.Add('XXXX分析報告' + #13#10);
strMsg := '打印時間:' + FormatDateTime('yyyy年hh月dd日 hh時MM分ss秒', Now);
redt1.Lines.Add(strMsg);
strMsg := '打印時間:' + FormatDateTime('yyyy年hh月dd日 hh時MM分ss秒', Now);
redt1.Lines.Add(strMsg);
strMsg := '進樣時間:' + FormatDateTime('yyyy年hh月dd日 hh時MM分ss秒', Now);
redt1.Lines.Add(strMsg);
strMsg := '質檢(E)字第()號';
redt1.Lines.Add(strMsg);
strMsg := '送樣單位:' + 'XXX公司' + '儀器型號:' + 'SC-1001-09A';
redt1.Lines.Add(strMsg);
strMsg := '取樣日期:' + FormatDateTime('yyyy年hh月dd日 ', Now) + '收樣日期:' + FormatDateTime('yyyy年hh月dd日 ', Now);
redt1.Lines.Add(strMsg);
strMsg := '樣品批號:' + '' + '樣品名稱:' + '固液';
redt1.Lines.Add(strMsg);
strMsg := '樣品罐號:' + 'A-1-2';
redt1.Lines.Add(strMsg);
strMsg := '儀器文件控制參數:' + '#1111';
redt1.Lines.Add(strMsg);
strMsg := '';
redt1.Lines.Add(strMsg);
strMsg := 'C:\AAAAAAA\111.bmp';
redt1.Lines.Add(strMsg);
redt1.SelStart := 4;
redt1.Paragraph.Alignment := taCenter;
3.改變字體大小
//改變第二行的字體大小為15
RichEdit1.SelStart := Length(RichEdit1.Lines[0]);
RichEdit1.SelLength := Length(RichEdit1.Lines[1]) + 2;
richedit1.SelAttributes.Size := 15;