public UInt32Value GetStyleIndex(string valueType, XlsxCell xlsxCell)
        {
            uint fontId = xlsxCell.Font != null
                                ? FontManager.GetFont(xlsxCell.Font)
                                : FontManager.GetDefaultFont();

            uint borderId = xlsxCell.Border != null
                                ? BorderManager.GetBorder(xlsxCell.Border)
                                : BorderManager.GetDefaultBorder();

            uint fillId = xlsxCell.Fill != null
                                ? FillManager.GetFill(xlsxCell.Fill)
                                : FillManager.GetDefaultFill();

            uint numberingFormatId = xlsxCell.NumberingFormat != null
                                ? NumberingFormatManager.GetNumberingFormat(xlsxCell.NumberingFormat)
                                : GetIndexByDataType(valueType);

            IXlsxCellFormat cellFormat = new XlsxCellFormat {
                FontId            = fontId,
                BorderId          = borderId,
                FillId            = fillId,
                NumberFormatId    = numberingFormatId,
                ApplyNumberFormat = xlsxCell.ApplyNumberFormat,
                ApplyFont         = xlsxCell.ApplyFont,
                ApplyFill         = xlsxCell.ApplyFill
            };

            return(CellFormatManager.GetCellFormat(cellFormat));
        }
示例#2
0
 public XlsxCellFormat(string name, XlsxCellFormat baseFormat)
 {
     Name            = name;
     ForegroundColor = baseFormat.ForegroundColor;
     Border          = baseFormat.Border;
     NumberFormat    = baseFormat.NumberFormat;
 }
        public uint GetCellFormat(IXlsxCellFormat fillLayer)
        {
            XlsxCellFormat layer = fillLayer as XlsxCellFormat;

            if (layer == null)
            {
                throw new Exception("Unexpected Cell Format Type");
            }

            return(GetCellFormat(layer.NumberFormatId, layer.ApplyNumberFormat, layer.ApplyFont, layer.ApplyFill, layer.FontId, layer.FillId, layer.BorderId));
        }