excel内容转换成html代码,用c#获取excel表格内容,转换成html源代码输出,怎么判断和输出合并单元格?...

excel = new Excel.Application();

excel.UserControl = true;

excel.DisplayAlerts = false;

excel.Application.Workbooks.Open(fileName, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);

wbs = excel.Workbooks;

wb = wbs[1];

for (int k = 0; k < wb.Worksheets.Count; k++)

{

ws = (Excel.Worksheet)wb.Worksheets[k + 1];

if (ws == null) continue;

int rowCount = ws.UsedRange.Rows.Count;

int colCount = ws.UsedRange.Columns.Count;

sb.AppendLine("

for (int i = 0; i < rowCount; i++)

{

sb.AppendLine("

");

for (int j = 0; j < colCount; j++)

{

range1 = ws.Range[ws.Cells[i + 1, j + 1], ws.Cells[i + 1, j + 1]];

if (range1 != null)

{

if (range1.Text.ToString() == "")

{

sb.AppendLine("

");

}

else

{

sb.AppendLine("

" + range1.Text + "");

}

}

else

{

sb.AppendLine("");

}

}

sb.AppendLine("

");

}

sb.AppendLine("

");

sb.AppendLine("
");

如题

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值