fpvectorial: Improves html with images on tables

git-svn-id: trunk@51953 -
This commit is contained in:
sekelsenmat 2016-03-15 16:26:12 +00:00
parent 76f8f165ea
commit 421e396441
2 changed files with 29 additions and 3 deletions

View File

@ -2289,7 +2289,7 @@ var
OriginalColWidthsInMM: array of Double;
CurRowTableWidth: Double;
begin
SetLength(ColWidthsInMM, GetRowCount());
SetLength(ColWidthsInMM, GetColCount());
// Process predefined widths
for col := 0 to Length(ColWidthsInMM)-1 do

View File

@ -34,6 +34,7 @@ type
function ReadHeaderFromNode(ANode: TDOMNode; AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
procedure ReadParagraphFromNode(ADest: TvParagraph; ANode: TDOMNode; AData: TvTextPageSequence; ADoc: TvVectorialDocument);
function ReadSVGFromNode(ANode: TDOMNode; AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
function ReadSVGFromNode_WithEmbDoc(ANode: TDOMNode; AEmbDoc: TvEmbeddedVectorialDoc; ADoc: TvVectorialDocument): TvEntity;
function ReadMathFromNode(ANode: TDOMNode; AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
function ReadTableFromNode(ANode: TDOMNode; AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
function ReadTableRowNode(ATable: TvTable; ANode: TDOMNode; AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
@ -106,7 +107,7 @@ begin
// Raw text
if (ANode is TDOMText) and (lEntityName = '#text') then
begin
lTextValue := Trim(ANode.NodeValue);
lTextValue := RemoveLineEndingsAndTrim(ANode.NodeValue);
if (lTextValue <> '') then
begin
AData.AddParagraph().AddText(lTextValue);
@ -290,6 +291,11 @@ begin
lEmbVecImg.Height := lHeight;
end;
end;
'svg':
begin
lEmbVecImg := ADest.AddEmbeddedVectorialDoc();
ReadSVGFromNode_WithEmbDoc(lCurNode, lEmbVecImg, ADoc);
end;
end;
lCurNode := lCurNode.NextSibling;
@ -318,6 +324,26 @@ begin
end;
end;
function TvHTMLVectorialReader.ReadSVGFromNode_WithEmbDoc(ANode: TDOMNode;
AEmbDoc: TvEmbeddedVectorialDoc; ADoc: TvVectorialDocument): TvEntity;
var
CurSVG: TvEmbeddedVectorialDoc;
lText: TvText;
lDoc: TXMLDocument;
lImportedNode: TDOMNode;
begin
Result := nil;
CurSVG := AEmbDoc;
lDoc := TXMLDocument.Create;
try
lImportedNode := lDoc.ImportNode(ANode, True);
lDoc.AppendChild(lImportedNode);
CurSVG.Document.ReadFromXML(lDoc, vfSVG);
finally
lDoc.Free;
end;
end;
function TvHTMLVectorialReader.ReadMathFromNode(ANode: TDOMNode;
AData: TvTextPageSequence; ADoc: TvVectorialDocument): TvEntity;
var
@ -598,7 +624,7 @@ begin
Result := False;
lExt := LowerCase(ExtractFileExt(AFileName));
case lExt of
'.png', '.jpg', '.jpeg', '.bmp', '.xpm':
'.png', '.jpg', '.jpeg', '.bmp', '.xpm', '.gif':
Result := True
end;
end;