使用C#合并单元格在Excel中 [英] Merging Cells in Excel using C#
本文介绍了使用C#合并单元格在Excel中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个包含5个表的数据库。每个表包含24行,每行包含4列。
I have a database which contains 5 tables. Each table contains 24 rows and each row contains 4 columns.
我要显示Excel工作表中这些记录。每个表的标题是表的名字,但我无法合并列标题。
I want to display these records in Excel sheet. The heading of each table is the name of the table, but I am unable to merge the columns for heading.
请帮我。
推荐答案
使用互操作你得到一个单元格区域,并呼吁在该范围内的 .Merge()
方法
Using the Interop you get a range of cells and call the .Merge()
method on that range.
eWSheet.Range[eWSheet.Cells[1, 1], eWSheet.Cells[4, 1]].Merge();
这篇关于使用C#合并单元格在Excel中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文