public XLDrawingFont(IXLDrawingStyle style) { _style = style; FontName = "Tahoma"; FontSize = 9; Underline = XLFontUnderlineValues.None; FontColor = XLColor.FromIndex(64); }
private void Initialize(XLCell cell) { Author = cell.Worksheet.Author; Container = this; Anchor = XLDrawingAnchor.MoveAndSizeWithCells; Style = new XLDrawingStyle(); Int32 pRow = cell.Address.RowNumber; Double pRowOffset = 0; if (pRow > 1) { pRow--; double prevHeight = cell.CellAbove().WorksheetRow().Height; if (prevHeight > 7) { pRowOffset = prevHeight - 7; } } Position = new XLDrawingPosition { Column = cell.Address.ColumnNumber + 1, ColumnOffset = 2, Row = pRow, RowOffset = pRowOffset }; ZOrder = cell.Worksheet.ZOrder++; Style .Margins.SetLeft(0.1) .Margins.SetRight(0.1) .Margins.SetTop(0.05) .Margins.SetBottom(0.05) .Margins.SetAutomatic() .Size.SetHeight(59.25) .Size.SetWidth(19.2) .ColorsAndLines.SetLineColor(XLColor.Black) .ColorsAndLines.SetFillColor(XLColor.FromArgb(255, 255, 225)) .ColorsAndLines.SetLineDash(XLDashStyle.Solid) .ColorsAndLines.SetLineStyle(XLLineStyle.Single) .ColorsAndLines.SetLineWeight(0.75) .ColorsAndLines.SetFillTransparency(1) .ColorsAndLines.SetLineTransparency(1) .Alignment.SetHorizontal(XLDrawingHorizontalAlignment.Left) .Alignment.SetVertical(XLDrawingVerticalAlignment.Top) .Alignment.SetDirection(XLDrawingTextDirection.Context) .Alignment.SetOrientation(XLDrawingTextOrientation.LeftToRight) .Properties.SetPositioning(XLDrawingAnchor.Absolute) .Protection.SetLocked() .Protection.SetLockText(); _cell = cell; ShapeId = cell.Worksheet.Workbook.ShapeIdManager.GetNext(); }
public XLDrawingSize(IXLDrawingStyle style) { _style = style; }
public XLDrawingMargins(IXLDrawingStyle style) { _style = style; }
public XLDrawingColorsAndLines(IXLDrawingStyle style) { _style = style; }
public XLComment(XLCell cell, XLFormattedText <IXLComment> defaultComment, IXLFontBase defaultFont, IXLDrawingStyle style) : base(defaultComment, defaultFont) { Initialize(cell, style); }
public XLDrawingProperties(IXLDrawingStyle style) { _style = style; }
public XLDrawingWeb(IXLDrawingStyle style) { _style = style; }
public XLDrawingAlignment(IXLDrawingStyle style) { _style = style; }
public XLDrawingProtection(IXLDrawingStyle style) { _style = style; }
private void Initialize(XLCell cell, IXLDrawingStyle style = null, int?shapeId = null) { style = style ?? XLDrawingStyle.DefaultCommentStyle; shapeId = shapeId ?? cell.Worksheet.Workbook.ShapeIdManager.GetNext(); Author = cell.Worksheet.Author; Container = this; Anchor = XLDrawingAnchor.MoveAndSizeWithCells; Style = new XLDrawingStyle(); Int32 previousRowNumber = cell.Address.RowNumber; Double previousRowOffset = 0; if (previousRowNumber > 1) { previousRowNumber--; if (cell.Worksheet.Internals.RowsCollection.TryGetValue(previousRowNumber, out XLRow previousRow)) { previousRowOffset = Math.Max(0, previousRow.Height - 7); } else { previousRowOffset = Math.Max(0, cell.Worksheet.RowHeight - 7); } } Position = new XLDrawingPosition { Column = cell.Address.ColumnNumber + 1, ColumnOffset = 2, Row = previousRowNumber, RowOffset = previousRowOffset }; ZOrder = cell.Worksheet.ZOrder++; Style .Margins.SetLeft(style.Margins.Left) .Margins.SetRight(style.Margins.Right) .Margins.SetTop(style.Margins.Top) .Margins.SetBottom(style.Margins.Bottom) .Margins.SetAutomatic(style.Margins.Automatic) .Size.SetHeight(style.Size.Height) .Size.SetWidth(style.Size.Width) .ColorsAndLines.SetLineColor(style.ColorsAndLines.LineColor) .ColorsAndLines.SetFillColor(style.ColorsAndLines.FillColor) .ColorsAndLines.SetLineDash(style.ColorsAndLines.LineDash) .ColorsAndLines.SetLineStyle(style.ColorsAndLines.LineStyle) .ColorsAndLines.SetLineWeight(style.ColorsAndLines.LineWeight) .ColorsAndLines.SetFillTransparency(style.ColorsAndLines.FillTransparency) .ColorsAndLines.SetLineTransparency(style.ColorsAndLines.LineTransparency) .Alignment.SetHorizontal(style.Alignment.Horizontal) .Alignment.SetVertical(style.Alignment.Vertical) .Alignment.SetDirection(style.Alignment.Direction) .Alignment.SetOrientation(style.Alignment.Orientation) .Alignment.SetAutomaticSize(style.Alignment.AutomaticSize) .Properties.SetPositioning(style.Properties.Positioning) .Protection.SetLocked(style.Protection.Locked) .Protection.SetLockText(style.Protection.LockText); _cell = cell; ShapeId = shapeId.Value; }
private static Vml.TextBox GetTextBox(IXLDrawingStyle ds) { var sb = new StringBuilder(); var a = ds.Alignment; if (a.Direction == XLDrawingTextDirection.Context) sb.Append("mso-direction-alt:auto;"); else if (a.Direction == XLDrawingTextDirection.RightToLeft) sb.Append("direction:RTL;"); if (a.Orientation != XLDrawingTextOrientation.LeftToRight) { sb.Append("layout-flow:vertical;"); if (a.Orientation == XLDrawingTextOrientation.BottomToTop) sb.Append("mso-layout-flow-alt:bottom-to-top;"); else if (a.Orientation == XLDrawingTextOrientation.Vertical) sb.Append("mso-layout-flow-alt:top-to-bottom;"); } if (a.AutomaticSize) sb.Append("mso-fit-shape-to-text:t;"); var retVal = new Vml.TextBox {Style = sb.ToString()}; var dm = ds.Margins; if (!dm.Automatic) retVal.Inset = String.Format("{0}in,{1}in,{2}in,{3}in", dm.Left.ToString(CultureInfo.InvariantCulture), dm.Top.ToString(CultureInfo.InvariantCulture), dm.Right.ToString(CultureInfo.InvariantCulture), dm.Bottom.ToString(CultureInfo.InvariantCulture)); return retVal; }