public XSSFDxfStyleProvider(CT_Dxf dxf, int stripeSize, IIndexedColorMap colorMap) { this.stripeSize = stripeSize; this.colorMap = colorMap; if (dxf == null) { border = null; font = null; number = null; fill = null; } else { border = dxf.IsSetBorder() ? new XSSFBorderFormatting(dxf.border) : null; font = dxf.IsSetFont() ? new XSSFFontFormatting(dxf.font) : null; if (dxf.IsSetNumFmt()) { CT_NumFmt numFmt = dxf.numFmt; number = new ExcelNumberFormat((int)numFmt.numFmtId, numFmt.formatCode); } else { number = null; } fill = dxf.IsSetFill() ? new XSSFPatternFormatting(dxf.fill) : null; } }
CT_Dxf ConvertDxfStyle(CellStyle style) { var res = new CT_Dxf(); if (style.font != null) { res.font = ConvertFont(style.font); } if (style.format != null) { res.numFmt = ConvertNumFormat(style.format); } if (style.fill != null) { res.fill = ConvertFill(style.fill); } if (style.alignment != null) { res.alignment = ConvertAlignment(style.alignment); } if (style.border != null) { res.border = ConvertBorder(style.border); } return(res); }
public IPatternFormatting GetPatternFormatting() { CT_Dxf dxf = this.GetDxf(false); if (dxf == null || !dxf.IsSetFill()) { return((IPatternFormatting)null); } return((IPatternFormatting) new XSSFPatternFormatting(dxf.fill)); }
public IFontFormatting GetFontFormatting() { CT_Dxf dxf = this.GetDxf(false); if (dxf == null || !dxf.IsSetFont()) { return((IFontFormatting)null); } return((IFontFormatting) new XSSFFontFormatting(dxf.font)); }
public IBorderFormatting GetBorderFormatting() { CT_Dxf dxf = this.GetDxf(false); if (dxf == null || !dxf.IsSetBorder()) { return((IBorderFormatting)null); } return((IBorderFormatting) new XSSFBorderFormatting(dxf.border)); }
/** * Create a new border formatting structure if it does not exist, * otherwise just return existing object. * * @return - border formatting object, never returns <code>null</code>. */ public IBorderFormatting CreateBorderFormatting() { CT_Dxf dxf = GetDxf(true); CT_Border border; if (!dxf.IsSetBorder()) { border = dxf.AddNewBorder(); } else { border = dxf.border; } return(new XSSFBorderFormatting(border)); }
/** * Create a new pattern formatting structure if it does not exist, * otherwise just return existing object. * * @return - pattern formatting object, never returns <code>null</code>. */ public IPatternFormatting CreatePatternFormatting() { CT_Dxf dxf = GetDxf(true); CT_Fill fill; if (!dxf.IsSetFill()) { fill = dxf.AddNewFill(); } else { fill = dxf.fill; } return(new XSSFPatternFormatting(fill)); }
/** * Create a new font formatting structure if it does not exist, * otherwise just return existing object. * * @return - font formatting object, never returns <code>null</code>. */ public IFontFormatting CreateFontFormatting() { CT_Dxf dxf = GetDxf(true); CT_Font font; if (!dxf.IsSetFont()) { font = dxf.AddNewFont(); } else { font = dxf.font; } return(new XSSFFontFormatting(font)); }
internal CT_Dxf GetDxf(bool create) { StylesTable stylesSource = ((XSSFWorkbook)this._sh.Workbook).GetStylesSource(); CT_Dxf dxf = (CT_Dxf)null; if (stylesSource._GetDXfsSize() > 0 && this._cfRule.IsSetDxfId()) { int dxfId = (int)this._cfRule.dxfId; dxf = stylesSource.GetDxfAt(dxfId); } if (create && dxf == null) { dxf = new CT_Dxf(); this._cfRule.dxfId = (uint)(stylesSource.PutDxf(dxf) - 1); } return(dxf); }
/*package*/ internal CT_Dxf GetDxf(bool create) { StylesTable styles = ((XSSFWorkbook)_sh.Workbook).GetStylesSource(); CT_Dxf dxf = null; if (styles.GetDXfsSize() > 0 && _cfRule.IsSetDxfId()) { int dxfId = (int)_cfRule.dxfId; dxf = styles.GetDxfAt(dxfId); } if (create && dxf == null) { dxf = new CT_Dxf(); int dxfId = styles.PutDxf(dxf); _cfRule.dxfId = (uint)(dxfId - 1); } return(dxf); }
public int PutDxf(CT_Dxf dxf) { this.dxfs.Add(dxf); return(this.dxfs.Count); }
public IPatternFormatting CreatePatternFormatting() { CT_Dxf dxf = this.GetDxf(true); return((IPatternFormatting) new XSSFPatternFormatting(dxf.IsSetFill() ? dxf.fill : dxf.AddNewFill())); }
public IFontFormatting CreateFontFormatting() { CT_Dxf dxf = this.GetDxf(true); return((IFontFormatting) new XSSFFontFormatting(dxf.IsSetFont() ? dxf.font : dxf.AddNewFont())); }
public IBorderFormatting CreateBorderFormatting() { CT_Dxf dxf = this.GetDxf(true); return((IBorderFormatting) new XSSFBorderFormatting(dxf.IsSetBorder() ? dxf.border : dxf.AddNewBorder())); }