protected SheetRowItem FindRow(uint rindex)
        {
            SheetRowItem result = null;

            if (SheetRows != null && SheetRows.Any(x => x.RowIndex == rindex))
            {
                result = SheetRows.First(x => x.RowIndex == rindex);
            }

            return(result);
        }
        public void AddRow(SheetRowItem row)
        {
            if (SheetRows == null)
            {
                SheetRows = new List <SheetRowItem>();
            }

            if (SheetRows.Any(x => x.RowIndex == row.RowIndex))
            {
                throw new Exception("rowindex exist");
            }

            SheetRows.Add(row);
        }
        public void AddCell(SheetCellItem cell, uint rindex, SheetRowFormats rowFormats)
        {
            if (rindex < 1)
            {
                throw new ArgumentOutOfRangeException("rindex", "rowindex must greater than zero");
            }

            var r = FindRow(rindex);

            if (r == null)
            {
                r = new SheetRowItem(new List <SheetCellItem>(), rindex);
                if (rowFormats != null)
                {
                    r.RowHeight = rowFormats.RowHeight;
                }
                AddRow(r);
            }
            cell.RowIndex = rindex;
            r.RowCells.Add(cell);
        }
        protected Row CreateSheetRow(SheetRowItem item, uint rowIndex, SharedStringTablePart shareStringPart)
        {
            Row result = null;

            if (item != null && item.RowCells != null && item.RowCells.Any())
            {
                result = new Row {
                    RowIndex = rowIndex
                };
                if (item.RowHeight > 0)
                {
                    result.CustomHeight = BooleanValue.FromBoolean(true);
                    result.Height       = item.RowHeight;
                }

                foreach (var itm in item.RowCells.OrderBy(x => x.ColIndex))
                {
                    Cell cell = CreateCell(ColumnLetter((int)itm.ColIndex), item.RowIndex, itm.Data, itm.DataType, itm.Texts, shareStringPart, itm.FormatIndex);
                    result.AppendChild(cell);
                }
            }

            return(result);
        }