Page 1 of 1

how insert into TRichview a superscript or subscript symbol?

Posted: Tue Mar 07, 2006 6:22 am
by sky_234
1. Do you know that how insert into TRichview a superscript or subscript symbol? Example square symbol.
2. I have a problem again. I need judge those blank pape in preview model.Then I don't print those blank page, only print page that having text. How can I do?
Thanks.

Posted: Tue Mar 07, 2006 9:31 pm
by Sergey Tkachenko
1. You can move text up or down - change VShift property of text style
2. Blank pages? I guess, if they are created by user, the user wants them to be printed. If they were generated, it's better to change a generation procedure to not produce empty pages.

Well, ok.

Use RVPrint.GetFirstItemOnPage to get a range of items on the specified page

Code: Select all

var IsEmpty: Boolean;
      ParaNo, i, FirstItemNo, LastItemNo, Offs: Integer;

IsEmpty := True; // is the PageNo-th page  empty?
  // the first page has index = 1

RVPrint1.GetFirstItemOnPage(PageNo, FirstItemNo, Offs);
if PageNo=RVPrint1.PagesCount then
  LastItemNo := RichView1.ItemCount-1
else
  RVPrint1.GetFirstItemOnPage(PageNo+1, LastItemNo, Offs);

for i := FirstItemNo to LastItemNo do begin
  if RichView1.GetItemStyle(i)<0 then begin
    // nontext item on page
    IsEmpty := False;
    break;
  end;
  if RichView1.GetItemText(i)<>'' then begin
    // some text on page
    IsEmpty := False;
    break;
  end;
  ParaNo := RichView1.GetItemPara(i);
  if (RichView1.Style.ParaStyles[ParaNo].Background.Color<>clNone) or
     (RichView1.Style.ParaStyles[ParaNo].Border.Style<>rvbNone) then
    // visible paragraph background
    IsEmpty := False;
    break;
  end;
end;
As for code for printing only the specified pages, see
http://www.trichview.com/forums/viewtopic.php?t=87
"How to print the chosen pages"

Posted: Mon Apr 03, 2006 9:17 pm
by Denoson
You can modify standard action: ChangeFontAction (hide default dialog).