I have an invisible TRichView control with no parent that I use to convert HTMLto RTF.
When RTF is saved, TRVWinGraphicInterface.GetDeviceCaps is called and accesses the Canvas property. The control has no parent, so the handle cannot be created and the calls fails with the following call stack.
Shouldn't the control be using the screen canvas in this case?
Thanks you!
Vcl.Controls.TWinControl.CreateWnd
RVScroll.TRVScroller.CreateWnd
Vcl.Controls.TWinControl.CreateHandle
Vcl.Controls.TWinControl.HandleNeeded
Vcl.Controls.TControlCanvas.CreateHandle
Vcl.Graphics.TCanvas.RequiredState([csHandleValid,csFontValid,csPenValid,csBrushValid])
Vcl.Graphics.TCanvas.GetHandle
RVWinGrIn.TRVWinGraphicInterface.GetDeviceCaps($17DB8660,88)
RVFuncs.RV_InfoAboutSaD($13E498,$17DB8660,$17E01210)
CRVFData.TCustomRVFormattedData.GetSADForFormatting($17DB8660,$13E498)
CRVFData.TCustomRVFormattedData.Format_(False,True,False,0,$17DB8660,False,False,False,False,False)
CRVFData.TCustomRVFormattedData.Format(False,False)
RVTable.TRVTableItemInfo.UpdateCellXCoords($17E0A0B0,False,False,False)
RVTable.TRVTableItemInfo.InternalOnDocWidthChange(600,$17E0A0B0,nil,False,False,False,$17E01210)
RVTable.TRVTableItemInfo.OnDocWidthChange(600,nil,False,nil,$188A8DB0,nil,0,0,False,False,False)
RVTable.TRVTableItemInfo.SaveRTF($17DF4A20,'',$188A8DB0,26,0,$17DFB1E8,$17DFADF8,$17DFB098,$17DFB518,False)
CRVData.TCustomRVData.SaveRTFToStream($17DF4A20,'',False,0,536870911,$17DFABD0,$17DFB1E8,$17DFADF8,$17DFB098,$17DFB518,True,False,nil,nil,nil,nil,nil,nil)
RichView.TCustomRichView.SaveRTFToStream($17DF4A20,False)
Parentless TRichView control
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Unfortunately, some operations cannot be made in parentless TRichView.
I suggest to use TRVReportHelper component instead, RVReportHelper.RichView can work without a parent.
Important note: if document contains tables, it must be formatted before saving to RTF (in your case, the component tries to format a table itself, and fails; RVReportHelper must be formatted too, but it is formatted by calling RVReportHelper.Init)
I suggest to use TRVReportHelper component instead, RVReportHelper.RichView can work without a parent.
Important note: if document contains tables, it must be formatted before saving to RTF (in your case, the component tries to format a table itself, and fails; RVReportHelper must be formatted too, but it is formatted by calling RVReportHelper.Init)
It is the same problem - but now it is an access violation since Canvas being passed in is nil:
Vcl.Graphics.TCanvas.GetHandle
RVWinGrIn.TRVWinGraphicInterface.GetDeviceCaps(nil,88)
RVFuncs.RV_InfoAboutSaD($13E498,nil,$162D1220)
CRVFData.TCustomRVFormattedData.GetSADForFormatting(nil,$13E498)
CRVFData.TCustomRVFormattedData.Format_(False,True,False,0,nil,False,False,False,False,False)
CRVFData.TCustomRVFormattedData.Format(False,False)
RVTable.TRVTableItemInfo.UpdateCellXCoords($162DA0D8,False,False,False)
RVTable.TRVTableItemInfo.InternalOnDocWidthChange(600,$162DA0D8,nil,False,False,False,$162D1220)
RVTable.TRVTableItemInfo.OnDocWidthChange(600,nil,False,nil,$19CF8DB0,nil,0,0,False,False,False)
RVTable.TRVTableItemInfo.SaveRTF($162C49C0,'',$19CF8DB0,26,0,$162CB230,$162CAE40,$162CB0E0,$162CB560,False)
CRVData.TCustomRVData.SaveRTFToStream($162C49C0,'',False,0,536870911,$162CAC60,$162CB230,$162CAE40,$162CB0E0,$162CB560,True,False,nil,nil,nil,nil,nil,nil)
RichView.TCustomRichView.SaveRTFToStream($162C49C0,False)
Vcl.Graphics.TCanvas.GetHandle
RVWinGrIn.TRVWinGraphicInterface.GetDeviceCaps(nil,88)
RVFuncs.RV_InfoAboutSaD($13E498,nil,$162D1220)
CRVFData.TCustomRVFormattedData.GetSADForFormatting(nil,$13E498)
CRVFData.TCustomRVFormattedData.Format_(False,True,False,0,nil,False,False,False,False,False)
CRVFData.TCustomRVFormattedData.Format(False,False)
RVTable.TRVTableItemInfo.UpdateCellXCoords($162DA0D8,False,False,False)
RVTable.TRVTableItemInfo.InternalOnDocWidthChange(600,$162DA0D8,nil,False,False,False,$162D1220)
RVTable.TRVTableItemInfo.OnDocWidthChange(600,nil,False,nil,$19CF8DB0,nil,0,0,False,False,False)
RVTable.TRVTableItemInfo.SaveRTF($162C49C0,'',$19CF8DB0,26,0,$162CB230,$162CAE40,$162CB0E0,$162CB560,False)
CRVData.TCustomRVData.SaveRTFToStream($162C49C0,'',False,0,536870911,$162CAC60,$162CB230,$162CAE40,$162CB0E0,$162CB560,True,False,nil,nil,nil,nil,nil,nil)
RichView.TCustomRichView.SaveRTFToStream($162C49C0,False)
Sergey Tkachenko wrote:Unfortunately, some operations cannot be made in parentless TRichView.
I suggest to use TRVReportHelper component instead, RVReportHelper.RichView can work without a parent.
Important note: if document contains tables, it must be formatted before saving to RTF (in your case, the component tries to format a table itself, and fails; RVReportHelper must be formatted too, but it is formatted by calling RVReportHelper.Init)
-
- Site Admin
- Posts: 17557
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: