Не может иметь доступ к некоторым свойствам класса ExcelDrawing (из epplus) в vb.net - PullRequest
0 голосов
/ 28 июня 2019

Я делаю приложение vb.net.Когда я использую объект класса ExcelDrawing, я не могу получить доступ ко всем свойствам этого класса.

В моем классе ExcelDrawing у меня есть следующие свойства:

Namespace OfficeOpenXml.Drawing
Public Class ExcelDrawing
Inherits XmlHelper
Implements IDisposable

Public Const EMU_PER_PIXEL As Integer = 9525
Protected _drawings As ExcelDrawings
Protected _topNode As XmlNode
Protected Friend _id As Integer
Protected Friend _width As Integer
Protected Friend _height As Integer
Protected Friend _top As Integer
Protected Friend _left As Integer

Public ReadOnly Property From As ExcelPosition
'     Print drawing with sheet
Public Property Print As Boolean
Public ReadOnly Property [To] As ExcelPosition
Public Property Locked As Boolean
Public Property EditAs As eEditAs
Public Property Name As String

Public Overridable Sub SetSize(Percent As Integer)
Public Overridable Sub Dispose()
Public Sub SetSize(PixelWidth As Integer, PixelHeight As Integer)
Public Sub SetPosition(Row As Integer, RowOffsetPixels As Integer, Column As Integer, ColumnOffsetPixels As Integer)
Public Sub SetPosition(PixelTop As Integer, PixelLeft As Integer)
Public Sub AdjustPositionAndSize()
Public Class ExcelPosition
    Inherits XmlHelper

    Public Property Column As Integer
    Public Property Row As Integer
    '     Row Offset EMU units 1cm = 1/360000 1US inch = 1/914400 1pixel = 1/9525
    Public Property RowOff As Integer
End Class
End Class
End Namespace

Но, например, впример Интернета, они могут получить доступ ко всем свойствам (возможно, потому что они используют c #?):

   var shape = ws.Drawings.AddShape("txtDesc", eShapeStyle.Rect);
    shape.SetPosition(1, 5, 6, 5);
    shape.SetSize(400, 200);
    shape.Text = "This example"
    shape.Fill.Style = eFillStyle.SolidFill;
    shape.Fill.Color = Color.DarkSlateGray;
    shape.Fill.Transparancy = 20;
    shape.Border.Fill.Style = eFillStyle.SolidFill;
    shape.Border.LineStyle = eLineStyle.LongDash;
    shape.Border.Width = 1;
    shape.Border.Fill.Color = Color.Black;
    shape.Border.LineCap = eLineCap.Round;
    shape.TextAnchoring = eTextAnchoringType.Top;
    shape.TextVertical = eTextVerticalType.Horizontal;
    shape.TextAnchoringControl=false;

Ответы [ 2 ]

0 голосов
/ 28 июня 2019

Да, это было так.Я писал:

Dim shapeExisting As Drawing.ExcelDrawing = sheet1.Drawings("CabSup")

insted of:

Dim shapeExisting As Drawing.ExcelShape = sheet1.Drawings("CabSup")

Но теперь, когда я могу получить доступ к свойству, когда я пытаюсь изменить цвет уже существующей формы Excel, эта ошибкаПоявляется:

error190000_01.xml. Обнаружение ошибок в архиве "C: \ Users \ Federico \ Desktop \ ITD \ Templates \ TTD_5Col_2Bob_TD (amb3) .xlsx" Registros reparados: Dibujo de / xl / drawingings / drawing1.xml parte (Forma de dibujo)

Спасибо.

0 голосов
/ 28 июня 2019

Drawings.AddShape возвращает Drawing.ExcelShape, а не ExcelDrawing.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...