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]); }
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]); }