示例#1
0
        public Doc.Odf.Row GetRow(Doc.Odf.Table sheetData, int r, bool check)
        {
            if (check)
            {
                foreach (Doc.Odf.DocumentElement drow in sheetData)
                {
                    if (drow is Doc.Odf.Row row && row.Index == r)
                    {
                        return(row);
                    }
                }
            }
            var rez = new Doc.Odf.Row(sheetData.Document)
            {
                Index     = r,
                StyleName = "ro2"
            };

            sheetData.Add(rez);
            return(rez);
        }
示例#2
0
        public void ExpMapLayout(Doc.Odf.Table sheetData, LayoutColumn map, int scol, int srow, out int mcol, out int mrow, LayoutList list, object listItem)
        {
            int tws = map.GetWithdSpan();

            //int ths = tool.LayoutMapTool.GetHeightSpan(map);
            mrow = srow;
            mcol = scol;
            Doc.Odf.Row temp = null;
            for (int i = 0; i < map.Count; i++)
            {
                var item = map[i];
                if (!item.Visible)
                {
                    continue;
                }

                map.GetVisibleIndex(item, out int cc, out int rr);
                int c = cc + scol;
                int r = rr + srow;
                if (item.Count > 0)
                {
                    ExpMapLayout(sheetData, item, c, r, out c, out r, list, listItem);
                }
                else
                {
                    Doc.Odf.Cell cell = GetCell(sheetData, c, r);

                    if (list != null)
                    {
                        cell.StyleName = "ce3";
                        cell.Val       = list.FormatValue(listItem, (ILayoutCell)item) as string;
                    }
                    else
                    {
                        cell.StyleName = "ce1";
                        cell.Val       = item.Text;
                        GetColumn(sheetData, c + 1, item.Width);
                    }
                    if (temp == null || temp.Index != r)
                    {
                        temp = GetRow(sheetData, r, mrow >= r);
                    }

                    if (r > mrow && r > srow)
                    {
                        for (int j = 0; j < scol; j++)
                        {
                            var ccell = new Doc.Odf.CoveredCell(sheetData.Document);
                            temp.Add(ccell);
                        }
                    }

                    temp.Add(cell);

                    int ws = map.GetRowWidthSpan(item.Row);
                    if (tws > ws)
                    {
                        cell.NumberColumnsSpanned = ((tws - ws) + 1).ToString();
                        cell.NumberRowsSpanned    = "1";
                        var ccell = new Doc.Odf.CoveredCell(sheetData.Document)
                        {
                            ColumnsRepeatedCount = (tws - ws).ToString()
                        };
                        temp.Add(ccell);
                    }
                    int hs = map.GetRowHeightSpan(item.Row, true);
                    if (hs > 1)
                    {
                        cell.NumberRowsSpanned = (hs).ToString();
                        if (cell.NumberColumnsSpanned.Length == 0)
                        {
                            cell.NumberColumnsSpanned = "1";
                        }
                    }
                }

                if (r > mrow)
                {
                    mrow = r;
                }
                if (c > mcol)
                {
                    mcol = c;
                }
            }
        }