以编程方式更改Excel工作表的行高

mspsb9vt  于 2023-01-18  发布在  其他
关注(0)|答案(9)|浏览(165)

我怎样才能改变EXCEL表格中所有非空行的行高呢?先谢谢你。

ufj5ltwl

ufj5ltwl1#

...EntireRow.RowHeight = value;
fnatzsnv

fnatzsnv3#

我使用以下代码:

xlWorkSheet.Rows.RowHeight = height;
        xlWorkSheet.StandardWidth = width;
jfewjypa

jfewjypa4#

MySheet.UsedRange.EntireRow.Height = value;
tsm1rwdh

tsm1rwdh5#

MySheet.UsedRange.EntireRow.Height

只准备好了。可惜没用。
试试这个:

NamedRange.RowHeight = X;

请查看MSDN以获取更多信息:http://msdn.microsoft.com/en-us/library/microsoft.office.tools.excel.namedrange.rowheight%28v=vs.80%29.aspx

nfzehxib

nfzehxib6#

这对我很有效:

var SomeCell = (Excel.Range)_xlSheet.Cells[1, 1];             
SomeCell.Value2 = "What was D.D. Eisenhower's Gettysburg Address?";
SomeCell.RowHeight = 32;
41zrol4v

41zrol4v7#

试试这个
sampleRange.Resize.RowHeight=x; //x's type must int

dwbf0jvd

dwbf0jvd8#

试试这个,你可以用一个for循环来循环true所有的行

int i = 0;

        for (var i = 0; i < column.Count(); i++)
        {
            worksheet.Row(i).Height = 100;
        }
nfg76nw0

nfg76nw09#

using (XLWorkbook xLWorkbook = new XLWorkbook())
       {
         var wordsheet = xLWorkbook.Worksheets.Add(dtEmpDetail, status);
         wordsheet.Row(2).Height = 50;
         wordsheet.Range("A1:d2").Merge();
        }

相关问题