开发者

Find the end of a Table produced using eDocEngine

We have several reports which outputs separate tables into a PDF using Gnostice's eDocEngine, which all works fine provided the data fits in the cells properly.

The problem is when the data wraps it changes the row height, making the table larger. This means when we output the next table it overlaps and ruins the report output. At the moment we use workarounds such as testing the string length to see if will wrap or adding a constant to the next tables top to a add a little space just in case the top table g开发者_如何学编程rows a bit.

What I'd like to be able to do is after calling EndTable get the tables height, or bottom so I can adjust subsequent tables accordingly.

We are using Delphi 2007, eDocEngine 2.5


Type TExposeProtectedeDocEngine = Class (TgtCustomDocumentEngine)
    public
        function GetTableBottom: Double;
        function GetTableTop: Double;
        Function GetTableHeight: Double;
End;

{ TExposeProtectedeDocEngine }

function TExposeProtectedeDocEngine.GetTableTop: Double;
begin
    if Assigned(FTableItem) then
    begin
        Result := FTableItem.Y;
    end
    else
        Result := 0;
end;

function TExposeProtectedeDocEngine.GetTableHeight: Double;
var
  i: Integer;
begin
    Result := 0;
    if Assigned(FTableItem) then
    begin
        for i := 0 to FTableItem.RowHeights.Count - 1 do
            Result := Result + Int64(FTableItem.RowHeights[i]);
    end;
end;

function TExposeProtectedeDocEngine.GetTableBottom: Double;
begin
    Result := GetTableHeight + GetTableTop;
end;

function GetPreviousTableBottom(Engine : TgtCustomDocumentEngine): Double;
begin
    Result := TExposeProtectedeDocEngine(Engine).GetTableBottom;
end;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜