如何将单元格方向= 45设置为以下代码. [英] How to set cell Orientation=45 to the following code.

查看:106
本文介绍了如何将单元格方向= 45设置为以下代码.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

foreach (GridViewRow r in GridView1.Rows)
        {
            if (r.RowType == DataControlRowType.DataRow)
            {
                for (int columnIndex = 0; columnIndex < r.Cells.Count; columnIndex++)
                {
                    r.Cells[columnIndex].Attributes.Add("class", "text");
                }
            }
        }


       
        GridView1.RenderControl(htmlWrite);
        string style = @"<style> .text { mso-number-format:\@; } </style> ";
        Response.Write(style);



如何将单元格标题方向设置为45.这样,当我导出时,我应该获得方向为45(度)的excel标题.



How can I set cell Headers orientation to 45 . so that when I export I should get the excel Headers with orientation with 45(degree).

推荐答案

做一个response.write你的样式是丑陋的,你应该把它在页面中,或至少将其呈现给控件,以便您控制它的位置.为什么您的HTML包含特定于Excel而不是HTML的数据?首先如何导出到Excel?我想当您进行导出时,如果实际上是在生成一个xls,那是您要设置特定于Excel的属性的时间.
Doing a response.write of your style is hideous, you should put it in the page, or at least render it to a control so you control where it goes. Why would your HTML contain data that is specific to Excel, which is not HTML ? How do you export to Excel in the first place ? I would think when you do the export, if you''re actually generating an xls, that is the time when you want to set properties specific to Excel.


这篇关于如何将单元格方向= 45设置为以下代码.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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