Ejemplo n.º 1
0
        private void ReadStyles()
        {
            using var reader = _zipWorker.GetStylesReader();
            if (reader == null)
            {
                return;
            }

            Record record;

            while ((record = reader.Read()) != null)
            {
                switch (record)
                {
                case ExtendedFormatRecord xf:
                    ExtendedFormats.Add(xf.ExtendedFormat);
                    break;

                case CellStyleExtendedFormatRecord csxf:
                    CellStyleExtendedFormats.Add(csxf.ExtendedFormat);
                    break;

                case NumberFormatRecord nf:
                    AddNumberFormat(nf.FormatIndexInFile, nf.FormatString);
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        internal void AddXf(XlsBiffXF xf)
        {
            var extendedFormat = new ExtendedFormat()
            {
                FontIndex           = xf.Font,
                NumberFormatIndex   = xf.Format,
                Locked              = xf.IsLocked,
                Hidden              = xf.IsHidden,
                HorizontalAlignment = xf.HorizontalAlignment,
                IndentLevel         = xf.IndentLevel,
                ParentCellStyleXf   = xf.ParentCellStyleXf,
            };

            // The workbook holds two kinds of XF records: Cell XFs, and Cell Style XFs.
            // In the binary XLS format, both kinds of XF records are saved in a single list,
            // whereas the XLSX format has two separate lists - like the CommonWorkbook internals.
            // The Cell XFs hold indexes into the Cell Style XF list, so adding the XF in both lists
            // here to keep the indexes the same.
            ExtendedFormats.Add(extendedFormat);
            CellStyleExtendedFormats.Add(extendedFormat);
        }