示例#1
0
        public IHTMLElement Row_InsertCell(IHTMLTableRow row, int index)
        {
            IHTMLElement elem = row.insertCell(index) as IHTMLElement;

            if (elem != null)
            {
                elem.innerHTML = HtmlSpace;
            }
            return(elem);
        }
        /// <summary>
        /// Inserts a new cell in the selected table
        /// </summary>
        public void InsertCell()
        {
            IHTMLTableCell selectedCell = this.GetSelectedTableCellElement();

            if (selectedCell != null)
            {
                IHTMLTableRow row          = (selectedCell as IHTMLElement).parentElement as IHTMLTableRow;
                row.insertCell().innerHTML = "&nbsp;";
            }
        }
示例#3
0
        public IHTMLElement Row_InsertCell(IHTMLTableRow row, int index, string cellwidth)
        {
            IHTMLElement elem = row.insertCell(index) as IHTMLElement;

            if (elem != null)
            {
                elem.innerHTML = HtmlSpace;
                if (!string.IsNullOrEmpty(cellwidth))
                {
                    IHTMLTableCell tcell = elem as IHTMLTableCell;
                    if (tcell != null)
                    {
                        tcell.width = cellwidth;
                    }
                }
            }
            return(elem);
        }
 public IHTMLElement Row_InsertCell(IHTMLTableRow row, int index, string cellwidth)
 {
     IHTMLElement elem = row.insertCell(index) as IHTMLElement;
     if (elem != null)
     {
         elem.innerHTML = HtmlSpace;
         if (!string.IsNullOrEmpty(cellwidth))
         {
             IHTMLTableCell tcell = elem as IHTMLTableCell;
             if (tcell != null)
             {
                 tcell.width = cellwidth;
             }
         }
     }
     return elem;
 }
 public IHTMLElement Row_InsertCell(IHTMLTableRow row, int index)
 {
     IHTMLElement elem = row.insertCell(index) as IHTMLElement;
     if (elem != null)
         elem.innerHTML = HtmlSpace;
     return elem;
 }
示例#6
0
 private IHTMLTableCell InsertCell(IHTMLTableRow row, int index)
 {
     IHTMLElement cell = (IHTMLElement)row.insertCell(index);
     return cell as IHTMLTableCell;
 }
示例#7
0
        //bordersize 2 or "2"
        public bool AppendTable(int colnum, int rownum, int bordersize, string alignment, int cellpadding, int cellspacing, string widthpercentage, int widthpixel, string backcolor, string bordercolor, string lightbordercolor, string darkbordercolor)
        {
            if (m_pDoc2 == null)
            {
                return(false);
            }
            IHTMLTable t = (IHTMLTable)m_pDoc2.createElement("table");

            //set the cols
            t.cols   = colnum;
            t.border = bordersize;

            if (!string.IsNullOrEmpty(alignment))
            {
                t.align = alignment;     //"center"
            }
            t.cellPadding = cellpadding; //1
            t.cellSpacing = cellspacing; //2

            if (!string.IsNullOrEmpty(widthpercentage))
            {
                t.width = widthpercentage; //"50%";
            }
            else if (widthpixel > 0)
            {
                t.width = widthpixel; //80;
            }
            if (!string.IsNullOrEmpty(backcolor))
            {
                t.bgColor = backcolor;
            }

            if (!string.IsNullOrEmpty(bordercolor))
            {
                t.borderColor = bordercolor;
            }

            if (!string.IsNullOrEmpty(lightbordercolor))
            {
                t.borderColorLight = lightbordercolor;
            }

            if (!string.IsNullOrEmpty(darkbordercolor))
            {
                t.borderColorDark = darkbordercolor;
            }

            //Insert rows and fill them with space
            int cells = colnum - 1;
            int rows  = rownum - 1;

            CalculateCellWidths(colnum);
            for (int i = 0; i <= rows; i++)
            {
                IHTMLTableRow tr = (IHTMLTableRow)t.insertRow(-1);
                for (int j = 0; j <= cells; j++)
                {
                    IHTMLElement c = tr.insertCell(-1) as IHTMLElement;
                    if (c != null)
                    {
                        c.innerHTML = HtmlSpace;
                        IHTMLTableCell tcell = c as IHTMLTableCell;
                        if (tcell != null)
                        {
                            //set width so as user enters text
                            //the cell width would not adjust
                            if (j == cells) //last cell
                            {
                                tcell.width = m_lastcellwidth;
                            }
                            else
                            {
                                tcell.width = m_cellwidth;
                            }
                        }
                    }
                }
            }

            //Append to body DOM collection
            IHTMLDOMNode nd   = (IHTMLDOMNode)t;
            IHTMLDOMNode body = (IHTMLDOMNode)m_pDoc2.body;

            return(body.appendChild(nd) != null);
        }