mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 16:59:11 +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;
|
procedure TvHTMLVectorialReader.ReadParagraphFromNode(ADest: TvParagraph; ANode: TDOMNode;
|
||||||
AData: TvTextPageSequence; ADoc: TvVectorialDocument);
|
AData: TvTextPageSequence; ADoc: TvVectorialDocument);
|
||||||
var
|
var
|
||||||
lText: TvText;
|
lText: TvText = nil;
|
||||||
|
lTextSeparatedByBR: Boolean = False;
|
||||||
lTextStr: string;
|
lTextStr: string;
|
||||||
lCurNode: TDOMNode;
|
lCurNode: TDOMNode;
|
||||||
lNodeName, lNodeValue, lAttrName, lAttrValue: DOMString;
|
lNodeName, lNodeValue, lAttrName, lAttrValue: DOMString;
|
||||||
@ -155,17 +156,35 @@ begin
|
|||||||
lCurNode := ANode.FirstChild;
|
lCurNode := ANode.FirstChild;
|
||||||
while Assigned(lCurNode) do
|
while Assigned(lCurNode) do
|
||||||
begin
|
begin
|
||||||
lNodeName := lCurNode.NodeName;
|
lNodeName := LowerCase(lCurNode.NodeName);
|
||||||
lNodeValue := lCurNode.NodeValue;
|
lNodeValue := lCurNode.NodeValue;
|
||||||
|
|
||||||
if lCurNode is TDOMText then
|
if (lCurNode is TDOMText) and not lTextSeparatedByBR then
|
||||||
begin
|
begin
|
||||||
lTextStr := lNodeValue;
|
lTextStr := lNodeValue;
|
||||||
lText := ADest.AddText(lTextStr);
|
lText := ADest.AddText(lTextStr);
|
||||||
lCurNode := lCurNode.NextSibling;
|
lCurNode := lCurNode.NextSibling;
|
||||||
Continue;
|
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;
|
end;
|
||||||
|
|
||||||
|
// reset text merging
|
||||||
|
lText := nil;
|
||||||
|
lTextSeparatedByBR := False;
|
||||||
|
|
||||||
case lNodeName of
|
case lNodeName of
|
||||||
// <image width="100" height="100" xlink:href="data:image/png;base64,UgAAA....QSK5CYII="/>
|
// <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" />
|
// <img src="images/noimage.gif" width="100" height="100" alt="No image" />
|
||||||
|
Loading…
Reference in New Issue
Block a user