Пример #1
0
 private void parseMegreCells(Worksheet worksheet, XWorksheet xWorksheet)
 {
     foreach (MergeCells mergeCells in worksheet.Descendants <MergeCells>())
     {
         foreach (MergeCell mergeCell in mergeCells.Descendants <MergeCell>())
         {
             XMergeCell xmc = new XMergeCell(mergeCell.Reference);
             xWorksheet.MergeCells.Add(xmc);
         }
     }
 }
Пример #2
0
 private void ApplyMerge()
 {
     for (int i = 0; i < MergeCells.Count; i++)
     {
         XMergeCell xmc  = MergeCells[i];
         string     temp = (string)cellOuterHtml.Rows[xmc.RowIndex][xmc.ColumnIndex];
         temp = temp.Replace("<td", "<td colspan='" + xmc.ColumnCount.ToString() + "' rowspan='" + "1" + "'");
         for (int ri = xmc.RowIndex; ri < (xmc.RowIndex + 1); ri++)
         {
             for (int ci = xmc.ColumnIndex; ci < (xmc.ColumnIndex + xmc.ColumnCount); ci++)
             {
                 cellOuterHtml.Rows[ri][ci] = "";
             }
         }
         cellOuterHtml.Rows[xmc.RowIndex][xmc.ColumnIndex] = temp;
     }
 }
Пример #3
0
 public void Add(XMergeCell xMergeCell)
 {
     Array.Resize <XMergeCell>(ref xmcs, Count + 1);
     xmcs[Count++] = xMergeCell;
 }