Commit 627b8e65 authored by GoshaZotov's avatar GoshaZotov

fix bug 32918

parent ef8f0d99
......@@ -1782,6 +1782,13 @@
}
var drawing = loader.ReadGraphicObject();
var isGraphicFrame = !!(typeof AscFormat.CGraphicFrame !== "undefined" && drawing instanceof AscFormat.CGraphicFrame);
//для случая, когда копируем 1 таблицу из презентаций, в бинарник заносим ещё одну такую же табличку, но со скомпиоированными стилями(для вставки в word / excel)
if(count === 1 && isGraphicFrame)
{
drawing = loader.ReadGraphicObject();
}
var x = stream.GetULong() / 100000;
var y = stream.GetULong() / 100000;
......@@ -1789,7 +1796,7 @@
var extY = stream.GetULong() / 100000;
var base64 = stream.GetString2();
if(count !== 1 && typeof AscFormat.CGraphicFrame !== "undefined" && drawing instanceof AscFormat.CGraphicFrame)
if(count !== 1 && isGraphicFrame)
{
drawing = AscFormat.DrawingObjectsController.prototype.createImage(base64, x, y, extX, extY);
arrBase64Img.push(new AscCommon.CBuilderImages(drawing.blipFill, base64, drawing, drawing.spPr, null));
......@@ -2718,42 +2725,66 @@
var heigthCell = cellTable.height;
var defaultStyle = "solid";
var borderStyleName;
var t = this;
var getBorderColor = function(curBorder)
{
var color = null;
var backgroundColor = null;
if(curBorder.Unifill && curBorder.Unifill.fill && curBorder.Unifill.fill.color && curBorder.Unifill.fill.color.color && curBorder.Unifill.fill.color.color.RGBA)
{
color = curBorder.Unifill.fill.color.color.RGBA;
backgroundColor = new AscCommonExcel.RgbColor(t.clipboard._getBinaryColor("rgb(" + color.R + "," + color.G + "," + color.B + ")"));
}
else
{
color = curBorder.Color;
backgroundColor = new AscCommonExcel.RgbColor(t.clipboard._getBinaryColor("rgb(" + color.r + "," + color.g + "," + color.b + ")"));
}
return backgroundColor;
};
var formatBorders = oldBorders ? oldBorders : new AscCommonExcel.Border();
//top border for cell
if(top == cellTable.top && !formatBorders.t.s && borders.Top.Value !== 0/*border_None*/)
{
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Top.Size,3,1));
if (null !== borderStyleName) {
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Top.Size, 3, 1));
if (null !== borderStyleName)
{
formatBorders.t.setStyle(borderStyleName);
formatBorders.t.c = new AscCommonExcel.RgbColor(this.clipboard._getBinaryColor("rgb(" + borders.Top.Color.r + "," + borders.Top.Color.g + "," + borders.Top.Color.b + ")"));
formatBorders.t.c = getBorderColor(borders.Top);
}
}
//left border for cell
if(left == cellTable.left && !formatBorders.l.s && borders.Left.Value !== 0/*border_None*/)
{
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Left.Size,3,1));
if (null !== borderStyleName) {
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Left.Size, 3, 1));
if (null !== borderStyleName)
{
formatBorders.l.setStyle(borderStyleName);
formatBorders.l.c = new AscCommonExcel.RgbColor(this.clipboard._getBinaryColor("rgb(" + borders.Left.Color.r + "," + borders.Left.Color.g + "," + borders.Left.Color.b + ")"));
formatBorders.l.c = getBorderColor(borders.Left);
}
}
//bottom border for cell
if(top == cellTable.top + heigthCell - 1 && !formatBorders.b.s && borders.Bottom.Value !== 0/*border_None*/)
{
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Bottom.Size,3,1));
if (null !== borderStyleName) {
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Bottom.Size, 3, 1));
if (null !== borderStyleName)
{
formatBorders.b.setStyle(borderStyleName);
formatBorders.b.c = new AscCommonExcel.RgbColor(this.clipboard._getBinaryColor("rgb(" + borders.Bottom.Color.r + "," + borders.Bottom.Color.g + "," + borders.Bottom.Color.b + ")"));
formatBorders.b.c = getBorderColor(borders.Bottom);
}
}
//right border for cell
if(left == cellTable.left + widthCell - 1 && !formatBorders.r.s && borders.Right.Value !== 0/*border_None*/)
{
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Right.Size,3,1));
if (null !== borderStyleName) {
borderStyleName = this.clipboard._getBorderStyleName(defaultStyle, this.ws.objectRender.convertMetric(borders.Right.Size, 3, 1));
if (null !== borderStyleName)
{
formatBorders.r.setStyle(borderStyleName);
formatBorders.r.c = new AscCommonExcel.RgbColor(this.clipboard._getBinaryColor("rgb(" + borders.Right.Color.r + "," + borders.Right.Color.g + "," + borders.Right.Color.b + ")"));
formatBorders.r.c = getBorderColor(borders.Right);
}
}
......@@ -2809,8 +2840,17 @@
if(compiledPrCell && compiledPrCell.Shd.Value !== 1/*shd_Nil*/)
{
var color = compiledPrCell.Shd.Color;
var shd = compiledPrCell.Shd;
if(shd.Unifill && shd.Unifill.fill && shd.Unifill.fill.color && shd.Unifill.fill.color.color && shd.Unifill.fill.color.color.RGBA)
{
var color = shd.Unifill.fill.color.color.RGBA;
backgroundColor = new AscCommonExcel.RgbColor(this.clipboard._getBinaryColor("rgb(" + color.R + "," + color.G + "," + color.B + ")"));
}
else
{
var color = shd.Color;
backgroundColor = new AscCommonExcel.RgbColor(this.clipboard._getBinaryColor("rgb(" + color.r + "," + color.g + "," + color.b + ")"));
}
};
};
......
......@@ -1134,7 +1134,8 @@ CopyProcessor.prototype =
}
else
{
this.CopyPresentationTableFull(oDomTarget, elements[i].Drawing);
var isOnlyTable = elements.length === 1 ? true : false;
this.CopyPresentationTableFull(oDomTarget, elements[i].Drawing, isOnlyTable);
this.oPresentationWriter.WriteDouble(elements[i].X);
this.oPresentationWriter.WriteDouble(elements[i].Y);
......@@ -1593,7 +1594,7 @@ CopyProcessor.prototype =
this.oBinaryFileWriter.copyParams.itemCount = 0;
},
CopyPresentationTableFull: function(oDomTarget, graphicFrame)
CopyPresentationTableFull: function(oDomTarget, graphicFrame, isOnlyTable)
{
var aSelectedRows = [];
var oRowElems = {};
......@@ -1624,11 +1625,66 @@ CopyProcessor.prototype =
this.oPresentationWriter.WriteBool(true);
this.oPresentationWriter.WriteString2(Item.TableStyle);
}
History.TurnOff();
this.oPresentationWriter.WriteTable(graphicFrame);
//для случая, когда копируем 1 таблицу из презентаций, в бинарник заносим ещё одну такую же табличку, но со скомпиоированными стилями(для вставки в word / excel)
if(isOnlyTable)
{
this.convertToCompileStylesTable(Item);
this.oPresentationWriter.WriteTable(graphicFrame);
}
History.TurnOn();
this.CopyTable(oDomTarget, Item, null);
},
convertToCompileStylesTable: function(table)
{
var t = this;
for(var i = 0; i < table.Content.length; i++)
{
var row = table.Content[i];
for(var j = 0; j < row.Content.length; j++)
{
var cell = row.Content[j];
var compilePr = cell.Get_CompiledPr();
cell.Pr = compilePr;
var shd = compilePr.Shd;
var color = shd.Get_Color2(this.oDocument.Get_Theme(), this.oDocument.Get_ColorMap());
cell.Pr.Shd.Unifill = AscFormat.CreteSolidFillRGB(color.r, color.g, color.b);
if(compilePr.TableCellBorders.Bottom)
{
var color = compilePr.TableCellBorders.Bottom.Get_Color2(this.oDocument.Get_Theme(), this.oDocument.Get_ColorMap());
cell.Pr.TableCellBorders.Bottom.Unifill = AscFormat.CreteSolidFillRGB(color.r, color.g, color.b);
}
if(compilePr.TableCellBorders.Top)
{
var color = compilePr.TableCellBorders.Top.Get_Color2(this.oDocument.Get_Theme(), this.oDocument.Get_ColorMap());
cell.Pr.TableCellBorders.Top.Unifill = AscFormat.CreteSolidFillRGB(color.r, color.g, color.b);
}
if(compilePr.TableCellBorders.Left)
{
var color = compilePr.TableCellBorders.Left.Get_Color2(this.oDocument.Get_Theme(), this.oDocument.Get_ColorMap());
cell.Pr.TableCellBorders.Left.Unifill = AscFormat.CreteSolidFillRGB(color.r, color.g, color.b);
}
if(compilePr.TableCellBorders.Right)
{
var color = compilePr.TableCellBorders.Right.Get_Color2(this.oDocument.Get_Theme(), this.oDocument.Get_ColorMap());
cell.Pr.TableCellBorders.Right.Unifill = AscFormat.CreteSolidFillRGB(color.r, color.g, color.b);
}
}
}
},
CopyGraphicObject: function(oDomTarget, oGraphicObj, drawingCopyObject)
{
var sSrc = oGraphicObj.getBase64Img();
......@@ -4071,6 +4127,21 @@ PasteProcessor.prototype =
var drawing = loader.ReadGraphicObject();
//для случая, когда копируем 1 таблицу из презентаций, в бинарник заносим ещё одну такую же табличку, но со скомпилированными стилями(для вставки в word/excel)
if(count === 1 && typeof AscFormat.CGraphicFrame !== "undefined" && drawing instanceof AscFormat.CGraphicFrame)
{
//в презентациях пропускаю чтение ещё раз графического объекта
if(presentation.Slides)
{
loader.stream.Skip2(1);
loader.stream.SkipRecord();
}
else
{
drawing = loader.ReadGraphicObject();
}
}
var x = stream.GetULong()/100000;
var y = stream.GetULong()/100000;
var extX = stream.GetULong()/100000;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment