如何通过C#在元数据上添加新行

时间:2016-10-12 01:49:58

标签: c# asp.net metadata

我通过Gridview导出文件.XML但元数据显示为enter image description here 我想要像enter image description here

这样的元数据

这是我的代码

    private void ExporttoExcel( DataTable table)
    {
        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.ClearContent();
        HttpContext.Current.Response.ClearHeaders();
        HttpContext.Current.Response.Buffer = true;
        HttpContext.Current.Response.ContentType = "application/xml";
        HttpContext.Current.Response.Write(@"<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">");
        HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename= Att " + txtPeriodeAwal.Text + " to " + txtPeriodeAkhir.Text + ".xml");

        HttpContext.Current.Response.Charset = "UTF-8";
        HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8;

        HttpContext.Current.Response.Write("<?xml version=\"1.0\"?>");
        HttpContext.Current.Response.Write("<?mso-application progid=\"Excel.Sheet\"?>");
        HttpContext.Current.Response.Write(" <Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\"");
        HttpContext.Current.Response.Write("xmlns:o=\"urn:schemas-microsoft-com:office:office\"");
        HttpContext.Current.Response.Write("xmlns:x=\"urn:schemas-microsoft-com:office:excel\"");
        HttpContext.Current.Response.Write("xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\"");
        HttpContext.Current.Response.Write("xmlns:html=\"http://www.w3.org/TR/REC-html40\">");
}

我可以在My Code上的元数据上获得新行缩进吗?

0 个答案:

没有答案