trichview.support
Re: RichAction and TPDFDocument componant |
Author |
Message |
Sergey Tkachenko |
Posted: 02/19/2005 15:56:31 Problems in this code: 1) Since rvrh.RichView is empty before calling DeleteUnusedStyles, this call deletes all styles but the 0-th. But these styles are used also by RichViewEdit1, so the most likely the document is damaged 2) rvrh.PagesCount>0 only if the document is formatted (rvrh.Init and rvrh.FormatNextPage are called). You can check if the document is loaded checking rvrh.RichView.ItemCount. In my tests, the document is loaded. 2) rvrh.Ready should always be False (this property works properly only in RVPrint), so the code inside IF should never be called. But when I removed this condition (also, I removed the lines pdf.Page[0].Size := GetPageSize; pdf.Page[0].Orientation := GetPageOrientation) the document was successfully converted to PDF. The best way to copy the document in the reporthelper: Stream: TMemoryStream; Stream := TMemoryStream.Create; RichViewEdit1.SaveRVFToStream(Stream,False); Stream.Position := 0; rvrh.RichView.Style := RVStyle1; rvrh.RichView.RVFTextStylesReadMode := rvf_sIgnore; rvrh.RichView.RVFParaStylesReadMode := rvf_sIgnore; if rvoTagsArePChars in RichViewEdit1.Options then rvrh.RichView.Options := rvrh.RichView.Options+[rvoTagsArePChars]; rvrh.RichView.Clear; rvrh.RichView.LoadRVFFromStream(Stream); Stream.Free; showmessage(inttostr(rvrh.RichView.ItemCount)); And remove if rvrh.Ready then |
Powered by ABC Amber Outlook Express Converter