We have been using ComponentOne 1.x for quite some time. We used C1PrintDocument to merge some RTF templates and generate PDF document. Recently we planed to upgrade our server to 64-bit machine. When we tested out the ComponentOne PDF generation code, we kept getting "Attempted to read or write protected memory. This is often an indication that other memory is corrupt" error. After upgrade to ComponentOne 2.x, that issue is gone. However, we ran into several other issues. When I re-compile the code after the upgrade, a lot of syntax do not work anymore. Some of them are easy to fix, but some of the deprecated functions are not that easy to replace since they no longer exist in the package. There are the changes I want to document here:
1. "Page [@@PageNo@@] of [@@PageCount@@]"
If you have used the code above, you have to add the following code now in order to use them:
c1PrintDocument1.TagOpenParen = "[@@";
c1PrintDocument1.TagCloseParen = "@@]";
2. Table border style
from:
RenderTable headerTable = new RenderTable(c1PrintDocument1);
headerTable.Style.Borders.AllEmpty = true;
headerTable.StyleTableCell.BorderTableHorz.Empty = true;
headerTable.StyleTableCell.BorderTableVert.Empty = true;
to:
RenderTable headerTable = new RenderTable(c1PrintDocument1);
headerTable.Style.Borders.All = LineDef.Empty;
headerTable.Style.GridLines.All = LineDef.Empty;
3. Page Header/Footer
from:
c1PrintDocument1.PageHeader.RenderObject = headerTable;
to:
c1PrintDocument1.PageLayouts.Default.PageHeader = headerTable;
4. Check remaining space
from:
RenderRichText obj = new RenderRichText(c1PrintDocument1);
obj = ...;
if (c1PrintDocument1.AvailableBlockFlowHeight < c1PrintDocument1.MeasureBlock(obj).Height)
c1PrintDocument1.NewPage();
to:
RenderRichText obj = new RenderRichText(c1PrintDocument1);
SizeD objSize = obj.CalcSize("2in", "auto");
if (c1PrintDocument1.AvailableBlockFlowHeight < objSize.Height)
c1PrintDocument1.NewPage();
No comments:
Post a Comment