数据插入到MS字自定义字段中. [英] Data inserting into MS-word custom fields.

查看:76
本文介绍了数据插入到MS字自定义字段中.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



您能否告诉我,在asp.net中如何将数据输入到MS-word自定义字段中

我在文本框中输入的我在vb.net deski顶级应用程序中做到了,是

在asp.net应用程序中可能.请给我一些代码来写数据.

Hi,

Could you please tell me, In asp.net how to enter data into MS-word custom fields

which i entered in a text box. i did this in vb.net deski top application , is it

possible in asp.net application. Plese suggest me some code to write data.

推荐答案

protected void GenerateMsWordDoc(object sender, EventArgs e)
    {
        string strBody = "<html>" +
            "<body>" +
                "<div>Your name is: <b>" + txtName.Text + "</b></div>" +
                "<table width="100%" style="background-color:#cfcfcf;"><tr><td>1st Cell body data</td><td>2nd cell body data</td></tr></table>" +
                "Ms Word document generated successfully." +
            "</body>" +
            "</html>";
        string fileName = "MsWordSample.doc";
        // You can add whatever you want to add as the HTML and it will be generated as Ms Word docs
        Response.AppendHeader("Content-Type", "application/msword");
        Response.AppendHeader ("Content-disposition", "attachment; filename="+ fileName);
        Response.Write(strBody);
    }



编辑-删除了多余的PRE标签. -Ankur



Edit - Removed the extra PRE tag. -Ankur


^(([[0-1] {1} [0-9] {1} | 2 [0-3]):([0-5] {1} [0-9] {1} | 60)| 24:00)
^(([0-1]{1}[0-9]{1}|2[0-3]):([0-5]{1}[0-9]{1}|60)|24:00)


这篇关于数据插入到MS字自定义字段中.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆