internal void SetLineStringAlignment(VerticalAlignments verticalAlignment, bool newFormatStrings) { StringAlignment lineAlignment = CreateLineStringAlignment(verticalAlignment); NewFormatStrings(newFormatStrings); m_stringFormat.LineAlignment = lineAlignment; }
internal XF GetDataCellXF(XlsDocument xls, Type dataType) { if (m_XF == null) { VerticalAlignments v1 = ConvertAlignments(VerticalAlignment).GetValueOrDefault(VerticalAlignments.Centered); bool hasBorder1 = HasBorder.GetValueOrDefault(true); XF xf = xls.NewXF(); xf.VerticalAlignment = v1; xf.Font.Height = (ushort)(10 * this.FONT_HEIGHT_SCALE); if (hasBorder1) { xf.LeftLineStyle = 1; xf.LeftLineColor = Colors.Black; xf.TopLineStyle = 1; xf.TopLineColor = Colors.Black; xf.RightLineStyle = 1; xf.RightLineColor = Colors.Black; xf.BottomLineStyle = 1; xf.BottomLineColor = Colors.Black; xf.TextWrapRight = true; } m_XF = xf; } HorizontalAlignments h1 = ConvertAlignments(HorizontalAlignment).GetValueOrDefault(SetDefaultHorizontalAlignmentsForType(dataType)); m_XF.HorizontalAlignment = h1; return(m_XF); }
public void SetLineStringAlignment(VerticalAlignments verticalAlignment, bool newFormatStrings) { StringAlignment lineAlignment = this.CreateLineStringAlignment(verticalAlignment); this.NewFormatStrings(newFormatStrings); this.m_stringFormat.LineAlignment = lineAlignment; }
private XF GetDataCellXF(int sheetIndex, Type dataType, int excelRowIndex, int excelColumnIndex, HorizontalAlignments?h, VerticalAlignments?v, bool?hasBorder) { HorizontalAlignments h1 = h.GetValueOrDefault(SetDefaultHorizontalAlignmentsForType(dataType)); VerticalAlignments v1 = v.GetValueOrDefault(VerticalAlignments.Centered); bool hasBorder1 = hasBorder.GetValueOrDefault(true); string key = "Cell" + h1.ToString() + v1.ToString() + (hasBorder1 ? "Y" : "N") + sheetIndex; if (!this.m_xlsXFs.ContainsKey(key)) { XF xf = this.m_xlsDocument.NewXF(); xf.HorizontalAlignment = h1; xf.VerticalAlignment = v1; xf.Font.Height = (ushort)(10 * this.FONT_HEIGHT_SCALE); if (hasBorder1) { xf.LeftLineStyle = 1; xf.LeftLineColor = Colors.Black; xf.TopLineStyle = 1; xf.TopLineColor = Colors.Black; xf.RightLineStyle = 1; xf.RightLineColor = Colors.Black; xf.BottomLineStyle = 1; xf.BottomLineColor = Colors.Black; xf.TextWrapRight = true; } SetXFForDataCell(sheetIndex, excelRowIndex, excelColumnIndex, xf); this.m_xlsXFs.Add(key, xf); return(xf); } return(this.m_xlsXFs[key]); }
public TextCellVM() { //Background Type typeBackground = typeof(System.Drawing.Color); PropertyInfo[] colorInfo = typeBackground.GetProperties(BindingFlags.Public | BindingFlags.Static); foreach (PropertyInfo info in colorInfo) { Colors.Add(info.Name); } //HorizontalAlignment foreach (var item in Enum.GetValues(typeof(HorizontalAlignment))) { HorizontalAlignments.Add((HorizontalAlignment)item); } //VerticalAlignment foreach (var item in Enum.GetValues(typeof(VerticalAlignment))) { VerticalAlignments.Add((VerticalAlignment)item); } //FontFamily foreach (var fontFamily in Fonts.SystemFontFamilies) { FontFamils.Add(fontFamily); } FontFamily = new FontFamily("Times New Roman"); FontSize = 12; }
private void SelectMode(StretchModeItem mode) { _suspend = true; stretchModes.SelectedIndex = StretchModes.Select(m => m.Tag).IndexOf(mode.Stretch); horizontalModes.SelectedIndex = HorizontalAlignments.Select(m => m.Tag).IndexOf(mode.HorizontalAlignment); verticalModes.SelectedIndex = VerticalAlignments.Select(m => m.Tag).IndexOf(mode.VerticalAlignment); _suspend = false; OnSelectionChanged(null, null); }
internal static ContentAlignment GetStyleContentAlignment(Style style, StyleInstance styleInstance) { TextAlignments styleTextAlign = GetStyleTextAlign(style, styleInstance); VerticalAlignments styleVerticalAlignment = GetStyleVerticalAlignment(style, styleInstance); ContentAlignment result = ContentAlignment.TopLeft; switch (styleTextAlign) { case TextAlignments.Center: switch (styleVerticalAlignment) { case VerticalAlignments.Bottom: result = ContentAlignment.BottomCenter; break; case VerticalAlignments.Middle: result = ContentAlignment.MiddleCenter; break; default: result = ContentAlignment.TopCenter; break; } break; case TextAlignments.Right: switch (styleVerticalAlignment) { case VerticalAlignments.Bottom: result = ContentAlignment.BottomRight; break; case VerticalAlignments.Middle: result = ContentAlignment.MiddleRight; break; default: result = ContentAlignment.TopRight; break; } break; default: switch (styleVerticalAlignment) { case VerticalAlignments.Bottom: result = ContentAlignment.BottomLeft; break; case VerticalAlignments.Middle: result = ContentAlignment.MiddleLeft; break; } break; } return(result); }
public AnchorPosition(HorizontalAlignments _horizontalAlignment, VerticalAlignments _verticalAlignment, bool _positionXAsPercent, bool _positionYAsPercent, bool _centerX, bool _centerY, Vector2 _screenPosition) { horizontalAlignment = _horizontalAlignment; verticalAlignment = _verticalAlignment; positionXAsPercent = _positionXAsPercent; positionYAsPercent = _positionYAsPercent; centerX = _centerX; centerY = _centerY; screenPosition = _screenPosition; }
/// <summary> /// Загрузить конфигурацию компонента из XML-узла /// </summary> public override void LoadFromXml(XmlNode xmlNode) { base.LoadFromXml(xmlNode); AutoSize = xmlNode.GetChildAsBool("AutoSize"); BackColor = xmlNode.GetChildAsString("BackColor"); BorderColor = xmlNode.GetChildAsString("BorderColor"); ForeColor = xmlNode.GetChildAsString("ForeColor"); Font = Font.GetChildAsFont(xmlNode, "Font"); Text = xmlNode.GetChildAsString("Text"); WordWrap = xmlNode.GetChildAsBool("WordWrap"); HAlign = xmlNode.GetChildAsEnum <HorizontalAlignments>("HAlign"); VAlign = xmlNode.GetChildAsEnum <VerticalAlignments>("VAlign"); }
internal static byte Translate(VerticalAlignments aValue) { switch (aValue) { case VerticalAlignments.Middle: return(1); case VerticalAlignments.Bottom: return(2); default: return(0); } }
private IEnumerable <StretchModeItem> GetAllModes() { var index = 0; foreach (var stretch in StretchModes.Select(m => m.Tag).OfType <Stretch>()) { foreach (var horizontalAlignment in HorizontalAlignments.Select(m => m.Tag).OfType <HorizontalAlignment>()) { foreach (var verticalAlignment in VerticalAlignments.Select(m => m.Tag).OfType <VerticalAlignment>()) { yield return(new StretchModeItem(index++, stretch, horizontalAlignment, verticalAlignment)); } } } }
private StringAlignment CreateLineStringAlignment(VerticalAlignments verticalAlignment) { switch (verticalAlignment) { case VerticalAlignments.Middle: return(StringAlignment.Center); case VerticalAlignments.Bottom: if (this.m_writingModeTopBottom) { return(StringAlignment.Near); } return(StringAlignment.Far); default: if (this.m_writingModeTopBottom) { return(StringAlignment.Far); } return(StringAlignment.Near); } }
private XF GetDataHeaderXF(int sheetIndex, int excelColumnIndex, HorizontalAlignments?h, VerticalAlignments?v, bool?hasBorder) { HorizontalAlignments h1 = h.GetValueOrDefault(HorizontalAlignments.Centered); VerticalAlignments v1 = v.GetValueOrDefault(VerticalAlignments.Centered); bool hasBorder1 = hasBorder.GetValueOrDefault(true); string key = "Header" + h1.ToString() + v1.ToString() + (hasBorder1 ? "Y" : "N") + sheetIndex; if (!this.m_xlsXFs.ContainsKey(key)) { XF xf = this.m_xlsDocument.NewXF(); xf.HorizontalAlignment = h1; xf.VerticalAlignment = v1; xf.Font.Height = (ushort)(10 * this.FONT_HEIGHT_SCALE); xf.Font.Weight = FontWeight.Bold; if (hasBorder1) { xf.Pattern = 1; xf.PatternColor = Colors.White; xf.LeftLineStyle = 1; xf.LeftLineColor = Colors.Black; xf.TopLineStyle = 1; xf.TopLineColor = Colors.Black; xf.RightLineStyle = 1; xf.RightLineColor = Colors.Black; xf.BottomLineStyle = 1; xf.BottomLineColor = Colors.Black; } else { xf.Pattern = 2; xf.PatternColor = Colors.White; } SetXFForHeader(sheetIndex, excelColumnIndex, xf); this.m_xlsXFs.Add(key, xf); return(xf); } return(this.m_xlsXFs[key]); }
public AnchorPosition (HorizontalAlignments _horizontalAlignment, VerticalAlignments _verticalAlignment, bool _positionXAsPercent, bool _positionYAsPercent, bool _centerX, bool _centerY, Vector2 _screenPosition) { horizontalAlignment = _horizontalAlignment; verticalAlignment = _verticalAlignment; positionXAsPercent = _positionXAsPercent; positionYAsPercent = _positionYAsPercent; centerX = _centerX; centerY = _centerY; screenPosition = _screenPosition; }
private void SetDefaults() { _font = new Font(_doc, this); _format = Formats.Default; _style = new Style(_doc, this); _horizontalAlignment = HorizontalAlignments.Default; _textWrapRight = false; _verticalAlignment = VerticalAlignments.Default; _rotation = 0; _indentLevel = 0; _shrinkToCell = false; _textDirection = TextDirections.Default; _cellLocked = false; //NOTE: Unsure about this default (compare to Commented XF String in BinData) _formulaHidden = false; //NOTE: Unsure about this default (compare to Commented XF String in BinData) _isStyleXF = false; //NOTE: Unsure about this default (compare to Commented XF String in BinData) _useNumber = true; _useFont = true; _useMisc = true; _useBorder = true; _useBackground = true; _useProtection = true; //You should ALWAYS use protection ;-) _leftLineStyle = 0; _rightLineStyle = 0; _topLineStyle = 0; _bottomLineStyle = 0; _leftLineColor = Colors.DefaultLineColor; _rightLineColor = Colors.DefaultLineColor; _diagonalDescending = false; _diagonalAscending = false; _topLineColor = Colors.DefaultLineColor; _bottomLineColor = Colors.DefaultLineColor; _diagonalLineColor = Colors.DefaultLineColor; _diagonalLineStyle = LineStyle.None; _pattern = 0; _patternColor = Colors.DefaultPatternColor; _patternBackgroundColor = Colors.DefaultPatternBackgroundColor; OnChange(); }
private void CreateFont(string family, ReportSize size, FontStyles style, FontWeights weight, TextDecorations decoration, TextAlignments alignment, VerticalAlignments verticalAlignment, Directions direction, WritingModes writingMode) { this.CreateGDIFont(family, size, style, weight, decoration); StringAlignment textStringAlignment = this.CreateTextStringAlignment(alignment); bool directionRightToLeft = false; if (direction == Directions.RTL) { directionRightToLeft = true; } this.SetWritingMode(writingMode); StringAlignment lineStringAlignment = this.CreateLineStringAlignment(verticalAlignment); this.CreateFormatString(textStringAlignment, lineStringAlignment, directionRightToLeft); }
public CanvasFont(string family, ReportSize size, FontStyles style, FontWeights weight, TextDecorations decoration, TextAlignments alignment, VerticalAlignments verticalAlignment, Directions direction, WritingModes writingMode) { this.CreateFont(family, size, style, weight, decoration, alignment, verticalAlignment, direction, writingMode); }