Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

bug found with richtext mailmerge (Delphi 7 - RB 10.09)

edited October 2008 in General
Hy, I've found a bug using richtext with mailmerge.
Sometimes, in particular situations, during rendering on screen of the
report, the TppRichText component loose the real value (eg.
)
and replace it with a fixed value calculated.
With the example included you can reproduce the error: click on the form
to preview the report, then goto forward one page, then backward one
page: the content of the richtext is duplicated on every row.

Debugging the application I've notice that the TppRichText component
saves his content into FMailMergeRTFStream into DoAfterBandPrint, so it
can be restored into MergeDbFields, but if the band is previewed over
two pages, the content is not correctly restored!
I've try a patch, calling DoAfterBandPrint into LoadRichText method, but
I don't know if this solution is correct, probably DoAfterBandPrint is
not the correct place to save the content, I suppose.
I've another question: why the TppRichText uses FMailMergeRTFStream
insted of FRichTextStream already defined in TppCustomRichText?

If the problem is patched, can you give me a feed-back so I can change
my source before waiting a new RBuilder version?
thanks.

Bye
Carlo Barazzetta


STEPS TO REPRODUCE THE BUG:
prerequisites: Delphi7, Paradox DBDEMOS, ReportBuilder 10.09
- New application with one form.
- FormClick event with command: ppreport1.Print;
- dfm as follow:

object Form1: TForm1
Left = 202
Top = 126
Width = 407
Height = 295
Caption = 'Form1'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnClick = FormClick
PixelsPerInch = 96
TextHeight = 13
object Table1: TTable
Active = True
DatabaseName = 'DBDEMOS'
TableName = 'customer'
TableType = ttParadox
Left = 68
Top = 32
end
object DataSource1: TDataSource
DataSet = Table1
Left = 56
Top = 120
end
object ppReport1: TppReport
AutoStop = False
DataPipeline = ppDBPipeline1
PrinterSetup.BinName = 'Default'
PrinterSetup.DocumentName = 'Report'
PrinterSetup.PaperName = 'A4'
PrinterSetup.PrinterName = 'Default'
PrinterSetup.mmMarginBottom = 6350
PrinterSetup.mmMarginLeft = 6350
PrinterSetup.mmMarginRight = 6350
PrinterSetup.mmMarginTop = 6350
PrinterSetup.mmPaperHeight = 297000
PrinterSetup.mmPaperWidth = 210000
PrinterSetup.PaperSize = 9
DeviceType = 'Screen'
EmailSettings.ReportFormat = 'PDF'
OutlineSettings.CreateNode = True
OutlineSettings.CreatePageNodes = True
OutlineSettings.Enabled = True
OutlineSettings.Visible = True
TextSearchSettings.DefaultString = ''
TextSearchSettings.Enabled = True
Left = 216
Top = 92
Version = '10.09'
mmColumnWidth = 0
DataPipelineName = 'ppDBPipeline1'
object ppHeaderBand1: TppHeaderBand
mmBottomOffset = 0
mmHeight = 13229
mmPrintPosition = 0
end
object ppDetailBand1: TppDetailBand
PrintHeight = phDynamic
mmBottomOffset = 0
mmHeight = 24342
mmPrintPosition = 0
object ppRichText1: TppRichText
UserName = 'RichText1'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = []
Border.BorderPositions = []
Border.Color = clBlack
Border.Style = psSolid
Border.Visible = False
Caption = 'RichText1'
MailMerge = True
RichText =
'{\rtf1\ansi\ansicpg1252\deff0\deflang1040{\fonttbl{\f0\fnil
MS S' +
'ans Serif;}}'#13#10'\viewkind4\uc1\pard\f0\fs16
Addr1' +
'\par'#13#10'}'#13#10
Stretch = True
Transparent = True
mmHeight = 3704
mmLeft = 0
mmTop = 0
mmWidth = 21696
BandType = 4
mmBottomOffset = 0
mmOverFlowOffset = 0
mmStopPosition = 0
end
object ppDBText2: TppDBText
UserName = 'DBText2'
Border.BorderPositions = []
Border.Color = clBlack
Border.Style = psSolid
Border.Visible = False
DataField = 'Addr1'
DataPipeline = ppDBPipeline1
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Name = 'Arial'
Font.Size = 10
Font.Style = []
Transparent = True
DataPipelineName = 'ppDBPipeline1'
mmHeight = 22754
mmLeft = 24077
mmTop = 0
mmWidth = 17198
BandType = 4
end
end
object ppFooterBand1: TppFooterBand
mmBottomOffset = 0
mmHeight = 47625
mmPrintPosition = 0
end
end
object ppDBPipeline1: TppDBPipeline
DataSource = DataSource1
UserName = 'DBPipeline1'
Left = 168
Top = 168
end
end

Comments

  • edited October 2008
    Hi Carlo,

    If possible, please send a working example of this issue in .zip format to
    support@digital-metaphors.com and I'll take a look at it for you.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2008
    Hi,
    I have Delphi 7 and Delphi 2007 with RB 10.09 on the same computer and on
    Delphi 2007 I'm having the same problem while D7 works just fine. I emailed
    you a sample project showing the problem.
    Regards,

    Gary


  • edited October 2008
    Hi.
    Now I get the same problem in both Delphi 7 and Delphi 2007.
    Here are a few notes I noticed while testnig
    - Setting Stretch property to false fixes the problem with merging.
    - Commenting out FMailMergeRTFStream.Clear in TppRichText.MergeDBFields
    procedure almost fixes the problem except on some pages where the first
    record still gets wrong data merged
    - EurekaLog reports memory leaks in TppCustomRichText.CalcSpaceUsed

    Regards

    Gary
  • edited October 2008
    Thanks Gary and Carlo,

    We received your examples and are currently researching a solution.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2008
    There is now a patch available that fixes this issue. Please email
    support@digital-metaphors.com if you would like this patch.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited October 2008
    Hi Nico,
    The problem still occurs in some cases. I emailed you sample project
    demonstrating it.
    Regards,

    Gary


This discussion has been closed.