void CreateColumnTitle(Range range, string text) { Formatting style = range.BeginUpdateFormatting(); try { style.Font.Name = defaultRegularFontName; style.Font.FontStyle = SpreadsheetFontStyle.Bold; style.Font.Color = DXColor.FromArgb(0xff, 0x33, 0x33, 0x33); style.Borders.BottomBorder.LineStyle = BorderLineStyle.Medium; style.Alignment.Vertical = SpreadsheetVerticalAlignment.Center; } finally { range.EndUpdateFormatting(style); } range.Value = text; }
void ExportCell(IXlRow row, int gridRowHandle, GridColumn gridColumn) { using (IXlCell cell = row.CreateCell()) { // Set cell value cell.Value = XlVariantValue.FromObject(this.view.GetRowCellValue(gridRowHandle, gridColumn)); // Get cell appearance AppearanceObject appearance = GetCellAppearance(gridRowHandle, gridColumn); // Apply alignment XlCellAlignment alignment = new XlCellAlignment() { WrapText = appearance.TextOptions.WordWrap.HasFlag(WordWrap.Wrap), VerticalAlignment = ConvertAlignment(appearance.TextOptions.VAlignment), HorizontalAlignment = ConvertAlignment(appearance.TextOptions.HAlignment) }; cell.ApplyFormatting(alignment); // Apply borders Color borderColor = appearance.GetBorderColor(); if (!DXColor.IsTransparentOrEmpty(borderColor)) { cell.ApplyFormatting(XlBorder.OutlineBorders(borderColor)); } // Apply fill if (appearance.Options.UseBackColor) { cell.ApplyFormatting(XlFill.SolidFill(appearance.BackColor)); } // Apply font Font appearanceFont = appearance.Font; XlFont font = XlFont.CustomFont(appearanceFont.Name); font.Size = appearanceFont.SizeInPoints; font.Bold = appearanceFont.Bold; font.Italic = appearanceFont.Italic; font.StrikeThrough = appearanceFont.Strikeout; font.Underline = appearanceFont.Underline ? XlUnderlineType.Single : XlUnderlineType.None; if (appearance.Options.UseForeColor) { font.Color = appearance.ForeColor; } cell.ApplyFormatting(font); } }
void SetInvoiceTotalCell(Cell cell, int goodsCount) { Formatting newFmt = cell.BeginUpdateFormatting(); try { newFmt.NumberFormat = accountingFormat; newFmt.Font.Color = DXColor.Black; newFmt.Fill.BackgroundColor = DXColor.FromArgb(0xff, 0xea, 0xea, 0xea); newFmt.Alignment.Horizontal = Spreadsheet.SpreadsheetHorizontalAlignment.Center; newFmt.Font.Size = 13.5; } finally { cell.EndUpdateFormatting(newFmt); } string formula = String.Format("=SUM(F{0}:F{1})", goodsStartRow + 1, goodsStartRow + goodsCount); cell.Formula = formula; }
void UpdatePageBackground(bool codeEvaluated) { CurrentCodeEditor.Document.SetPageBackground((codeEvaluated) ? DXColor.Empty : DXColor.FromArgb(0xFF, 0xBC, 0xC8), true); CurrentCodeClassEditor.Document.SetPageBackground((codeEvaluated) ? DXColor.Empty : DXColor.FromArgb(0xFF, 0xBC, 0xC8), true); }