首页 新闻 会员 周边 捐助

js导出为Word怎么合并行

0
悬赏园豆:50 [待解决问题]

 function OpenTemplate() {
            var url = "<%=Url %>";
            OpenWindow(url, 'wndWord', 0, 0);
        }
        function CreateWord() {
            var word = null;
            try {
                word = new ActiveXObject("Word.Application");
            }
            catch (e) {
                alert("不能创建Word实例,可能是您没安装Word或浏览器安全设置过高。");
                return false;
            }
            word.Visible = true;
            var url = "<%=Url %>";
            var doc = word.documents.open(url);
            var selection = word.Selection;
            selection.Font.Name = "微软雅黑"; //设置字体为宋体
            var b = selection.find.execute("{Product}");
            if (b == false) {
                doc.Close();
                word.Quit();
                alert("文件模板无效");
                return false;
            }
            var data = document.getElementById("ctl00_ContentHolder_TableData").value;
            var price = document.getElementById("ctl00_ContentHolder_hidSalesPrice").value;
            var rows = data.split('*');
            var columnCount = rows[0].split('\t').length;
            table = doc.Tables.Add(selection.Range, rows.length + 1, columnCount);
            table.Select();
            selection.Cells.VerticalAlignment = 1;
            for (i = 0; i < rows.length; i++) {
                var cols = rows[i].split('\t');
                for (j = 0; j < cols.length; j++) {
                    table.Cell(i + 1, j + 1).Range.Text = cols[j];
                }
            }

            table.Cell(rows.length + 1, 1).Range.Text = "合计";
            table.Cell(rows.length + 1, 2).Range.Text = price;
//            table.Cell(rows.length + 1, 2).Merge(table.Cell(rows.length + 1, 6));
//            table.Cell(rows.length + 2, 1).Range.Text = "备注:以上价格为我公司针对此项目的最优惠价格,仅对此项目有效。报价有效期为30天。";
//            table.Cell(rows.length + 2, 1).Merge(table.Cell(rows.length + 2, 5));

 

我想将红色的部分注释的部分进行合并,【总价格和备注】

易园的主页 易园 | 初学一级 | 园豆:150
提问于:2010-12-10 17:33
< >
分享
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册