MyException - 我的异常网
当前位置:我的异常网» .NET Framework » 手工制造《不圆满WinForm导出Word》-同样求教高手

手工制造《不圆满WinForm导出Word》-同样求教高手(5)

www.MyException.Cn  网友分享于:2013-02-20  浏览:66次

                                    //分离表头单元格,2行两列
                                    object RowNum = 2;
                                    object ColumNum = tv.Nodes[a].Nodes.Count;
                                    Word.Cell cell = newTable.Cell(j, i + 1);
                                    //先合并多出来的单元格
                                    cell.Merge(newTable.Cell(j, i + 2));
                                    //按照子节点个数分离合并后的单元格
                                    cell.Split(ref RowNum, ref ColumNum);
                                    //合并头部第一行,第二行不合并
                                    cell.Merge(newTable.Cell(j, i + 2));
                                    //循环为头部分离单元格循环赋值
                                    for (int d = 0; d < tv.Nodes[a].Nodes.Count; d++)//d代表节点下子节点索引
                                    {
                                        //循环赋值
                                        newTable.Cell(j + 1, i + d + a).Range.Text = tv.Nodes[a].Nodes[d].Text;
                                    }

文章评论

软件开发程序错误异常ExceptionCopyright © 2009-2015 MyException 版权所有