mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 09:38:12 +02:00
fpvectorial: Fixes reading multiline table cells
git-svn-id: trunk@49050 -
This commit is contained in:
parent
44f581d47d
commit
5032dc0af0
@ -132,7 +132,8 @@ end;
|
||||
procedure TvHTMLVectorialReader.ReadParagraphFromNode(ADest: TvParagraph; ANode: TDOMNode;
|
||||
AData: TvTextPageSequence; ADoc: TvVectorialDocument);
|
||||
var
|
||||
lText: TvText;
|
||||
lText: TvText = nil;
|
||||
lTextSeparatedByBR: Boolean = False;
|
||||
lTextStr: string;
|
||||
lCurNode: TDOMNode;
|
||||
lNodeName, lNodeValue, lAttrName, lAttrValue: DOMString;
|
||||
@ -155,17 +156,35 @@ begin
|
||||
lCurNode := ANode.FirstChild;
|
||||
while Assigned(lCurNode) do
|
||||
begin
|
||||
lNodeName := lCurNode.NodeName;
|
||||
lNodeName := LowerCase(lCurNode.NodeName);
|
||||
lNodeValue := lCurNode.NodeValue;
|
||||
|
||||
if lCurNode is TDOMText then
|
||||
if (lCurNode is TDOMText) and not lTextSeparatedByBR then
|
||||
begin
|
||||
lTextStr := lNodeValue;
|
||||
lText := ADest.AddText(lTextStr);
|
||||
lCurNode := lCurNode.NextSibling;
|
||||
Continue;
|
||||
end
|
||||
// If after a text we get a <br /> or a TDOMText, merge them
|
||||
else if (lNodeName = 'br') and (lText <> nil) then
|
||||
begin
|
||||
lTextSeparatedByBR := True;
|
||||
lCurNode := lCurNode.NextSibling;
|
||||
Continue;
|
||||
end
|
||||
else if (lCurNode is TDOMText) and lTextSeparatedByBR then
|
||||
begin
|
||||
lTextStr := lNodeValue;
|
||||
lText.Value.Add(lTextStr);
|
||||
lCurNode := lCurNode.NextSibling;
|
||||
Continue;
|
||||
end;
|
||||
|
||||
// reset text merging
|
||||
lText := nil;
|
||||
lTextSeparatedByBR := False;
|
||||
|
||||
case lNodeName of
|
||||
// <image width="100" height="100" xlink:href="data:image/png;base64,UgAAA....QSK5CYII="/>
|
||||
// <img src="images/noimage.gif" width="100" height="100" alt="No image" />
|
||||
|
Loading…
Reference in New Issue
Block a user