private static void SetCellProperties(PivotExportCellInfo cellInfo, CellSelection cellSelection) { var fill = GenerateFill(cellInfo.Background); if (fill != null) { cellSelection.SetFill(fill); } SolidColorBrush solidBrush = cellInfo.Foreground as SolidColorBrush; if (solidBrush != null) { cellSelection.SetForeColor(new ThemableColor(solidBrush.Color)); } if (cellInfo.FontWeight.HasValue && cellInfo.FontWeight.Value != FontWeights.Normal) { cellSelection.SetIsBold(true); } SolidColorBrush solidBorderBrush = cellInfo.BorderBrush as SolidColorBrush; if (solidBorderBrush != null && cellInfo.BorderThickness.HasValue) { var borderThickness = cellInfo.BorderThickness.Value; var color = new ThemableColor(solidBorderBrush.Color); //var leftBorder = new CellBorder(GetBorderStyle(borderThickness.Left), color); //var topBorder = new CellBorder(GetBorderStyle(borderThickness.Top), color); var rightBorder = new CellBorder(GetBorderStyle(borderThickness.Right), color); var bottomBorder = new CellBorder(GetBorderStyle(borderThickness.Bottom), color); var insideBorder = cellInfo.Background != null ? new CellBorder(CellBorderStyle.None, color) : null; cellSelection.SetBorders(new CellBorders(null, null, rightBorder, bottomBorder, insideBorder, insideBorder, null, null)); } }
public void IterateWorksheets() { #region radspreadsheet-model-working-with-worksheets-iterate-through-worksheets_1 Workbook workbook = new Workbook(); workbook.Worksheets.Add(); workbook.Worksheets.Add(); workbook.Worksheets.Add(); ThemableColor foregroundColor = new ThemableColor(Colors.Red); Color backgroundColor = Colors.Green; IFill backgroundFill = new PatternFill(PatternType.Solid, backgroundColor, backgroundColor); foreach (Worksheet worksheet in workbook.Worksheets) { CellSelection cell = worksheet.Cells[0, 0]; cell.SetValue("The name of this worksheet is: " + worksheet.Name); cell.SetForeColor(foregroundColor); cell.SetFill(backgroundFill); } #endregion }