|
![]() |
#1 |
Участник
|
X++: presetGeometry = new DocumentFormat.OpenXml.Drawing.PresetGeometry(); presetGeometry.set_AdjustValueList(new DocumentFormat.OpenXml.Drawing.AdjustValueList()); presetGeometry.set_Preset(OXMLExp::getEnumValue(DocumentFormat.OpenXml.Drawing.ShapeTypeValues::Rectangle)); OXML_RU::appendChild(shapeProperties, presetGeometry); OXML_RU::appendChild(shapeProperties, new DocumentFormat.OpenXml.Drawing.NoFill()); fromMarker = new DocumentFormat.OpenXml.Drawing.Spreadsheet.FromMarker(); fromMarker.set_ColumnId (new DocumentFormat.OpenXml.Drawing.Spreadsheet.ColumnId (int642str(_posX - 1))); //считается от нуля fromMarker.set_ColumnOffset (new DocumentFormat.OpenXml.Drawing.Spreadsheet.ColumnOffset(int642str(_posXOffcet * #EMU_per_pixel))); // convert to pixels fromMarker.set_RowId (new DocumentFormat.OpenXml.Drawing.Spreadsheet.RowId (int642str(_posY - 1))); //считается от нуля fromMarker.set_RowOffset (new DocumentFormat.OpenXml.Drawing.Spreadsheet.RowOffset (int642str(_posYOffcet * #EMU_per_pixel))); // convert to pixels toMarker = new DocumentFormat.OpenXml.Drawing.Spreadsheet.ToMarker(); toMarker.set_ColumnId (new DocumentFormat.OpenXml.Drawing.Spreadsheet.ColumnId (int642str(_posX - 1))); //считается от нуля toMarker.set_ColumnOffset (new DocumentFormat.OpenXml.Drawing.Spreadsheet.ColumnOffset(int642str((_posXOffcet + _width) * #EMU_per_pixel))); // convert to pixels toMarker.set_RowId (new DocumentFormat.OpenXml.Drawing.Spreadsheet.RowId (int642str(_posY - 1))); //считается от нуля toMarker.set_RowOffset (new DocumentFormat.OpenXml.Drawing.Spreadsheet.RowOffset (int642str((_posYOffcet + _height) * #EMU_per_pixel))); // convert to pixels twoCellAnchor = new DocumentFormat.OpenXml.Drawing.Spreadsheet.TwoCellAnchor(); twoCellAnchor.set_FromMarker(fromMarker); twoCellAnchor.set_ToMarker (toMarker); twoCellAnchor.set_EditAs(OXMLExp::getEnumValue(DocumentFormat.OpenXml.Drawing.Spreadsheet.EditAsValues::OneCell)); nonVisualDrawingProperties = new DocumentFormat.OpenXml.Drawing.Spreadsheet.NonVisualDrawingProperties(); nonVisualDrawingProperties.set_Id(OXML_RU::setUInt32Value(picId)); nonVisualDrawingProperties.set_Name(new DocumentFormat.OpenXml.StringValue(_fileName)); nonVisualPictureProperties = new DocumentFormat.OpenXml.Drawing.Spreadsheet.NonVisualPictureProperties(); nonVisualPictureProperties.set_NonVisualDrawingProperties(nonVisualDrawingProperties); nonVisualPictureProperties.set_NonVisualPictureDrawingProperties(new DocumentFormat.OpenXml.Drawing.Spreadsheet.NonVisualPictureDrawingProperties()); picture = new DocumentFormat.OpenXml.Drawing.Spreadsheet.Picture(); picture.set_NonVisualPictureProperties(nonVisualPictureProperties); picture.set_BlipFill(blipFill); picture.set_ShapeProperties(shapeProperties); OXML_RU::appendChild(twoCellAnchor, picture); OXML_RU::appendChild(twoCellAnchor, new DocumentFormat.OpenXml.Drawing.Spreadsheet.ClientData()); OXML_RU::appendChild(worksheetDrawing, twoCellAnchor); clearNet(); } Цитата:
- метод вставки картинки
основная замена: DocumentFormat.OpenXml.Drawing.Spreadsheet.AbsoluteAnchor на DocumentFormat.OpenXml.Drawing.Spreadsheet.TwoCellAnchor + добавлена очистка объектов (все это игнорируют, в исходнике даже FileStream не диспозился) |
|
Теги |
.net, ado, generic, net |
|
|