支持emf格式的图片(word中插入excel表格)
This commit is contained in:
@@ -459,11 +459,12 @@ begin
|
||||
if ifObj(r.Drawing._Inline.XmlNode) then
|
||||
begin
|
||||
id := r.Drawing._Inline.Graphic.GraphicData.Pic.BlipFill.Blip.Embed;
|
||||
image := {self.}GetImageData(id);
|
||||
[image_type, image] := {self.}GetImageData(id);
|
||||
if not image then return;
|
||||
xfrm := new XfrmUnitDecorator(r.Drawing._Inline.Graphic.GraphicData.Pic.SpPr.Xfrm);
|
||||
image_range := new TSPdfImageRange();
|
||||
image_range.Image := image;
|
||||
image_range.Type := image_type;
|
||||
image_range.StartX := xfrm.Off.X;
|
||||
image_range.StartY := xfrm.Off.Y;
|
||||
image_range.Width := xfrm.Ext.CX;
|
||||
@@ -474,7 +475,7 @@ begin
|
||||
begin
|
||||
anchor := r.Drawing.Anchor;
|
||||
id := anchor.Graphic.GraphicData.Pic.BlipFill.Blip.Embed;
|
||||
image := {self.}GetImageData(id);
|
||||
[image_type, image] := {self.}GetImageData(id);
|
||||
if not image then return;
|
||||
[x, y] := {self.}GetXYCordinates();
|
||||
xfrm := new XfrmUnitDecorator(anchor.Graphic.GraphicData.Pic.SpPr.Xfrm);
|
||||
@@ -486,6 +487,7 @@ begin
|
||||
y := {self.}StartY;
|
||||
image_range := new TSPdfImageRange();
|
||||
image_range.Image := image;
|
||||
image_range.Type := image_type;
|
||||
image_range.EndX := x + position_h.PosOffset.Text;
|
||||
image_range.EndY := y - position_v.PosOffset.Text - xfrm.Ext.CY;
|
||||
image_range.Width := xfrm.Ext.CX;
|
||||
@@ -541,7 +543,7 @@ end;
|
||||
function TSPdfParagraphRange.RObject(r: R);
|
||||
begin
|
||||
id := r.Object.Shape.Imagedata.Id;
|
||||
image := {self.}GetImageData(id);
|
||||
[image_type, image] := {self.}GetImageData(id);
|
||||
if not image then return;
|
||||
style := r.Object.Shape.Style;
|
||||
style_arr := str2array(style, ";");
|
||||
@@ -552,6 +554,7 @@ begin
|
||||
end
|
||||
image_range := new TSPdfImageRange();
|
||||
image_range.Image := image;
|
||||
image_range.Type := image_type;
|
||||
image_range.StartX := 0;
|
||||
image_range.StartY := 0;
|
||||
image_range.Width := w;
|
||||
@@ -591,14 +594,17 @@ begin
|
||||
image_path := docx_to_pdf_.GetCachePath(image_path);
|
||||
writeFile(rwBinary(), "", image_path, 0, length(data), data);
|
||||
image := nil;
|
||||
case GetImageFileType(data) of
|
||||
image_type := GetImageFileType(data);
|
||||
case image_type of
|
||||
"png":
|
||||
image := docx_to_pdf_.GetPdf().LoadPngImageFromFile("", image_path);
|
||||
"jpg":
|
||||
image := docx_to_pdf_.GetPdf().LoadJpegImageFromFile("", image_path);
|
||||
"emf":
|
||||
image := docx_to_pdf_.GetPdf().LoadEmfImageFromFile("", image_path);
|
||||
end;
|
||||
fileDelete("", image_path);
|
||||
return image;
|
||||
return array(image_type, image);
|
||||
end;
|
||||
|
||||
function TSPdfParagraphRange.GetImageFileType(data: binary): string;
|
||||
|
||||
Reference in New Issue
Block a user