使用C#在excel中更改一个单元格的字体大小 [英] Changing font size of one cell in excel using C#

查看:1170
本文介绍了使用C#在excel中更改一个单元格的字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理将数据写入Excel文件的项目。

I am working on a project that writes data to an Excel file.

所有内容都已经完成,但是我需要一些比其余的单元格(标题等)更大的单元格。

Everything is finished now, however I need a few cells with a bigger size than the rest (title, etc).

我已经阅读过关于互联网的信息,但是我仍然遇到同样的问题:当我执行我的代码(见下文,我已经尝试过),工作表变大。

I have read about this about the internet, but I keep having the same problem: when I execute my code (see below for what I have tried), everything in the worksheet becomes larger.

我已经尝试过:

worksheet.Rows[1].Cells[7].Style.Font.Size = 20; 

worksheet.get_Range("A7", "A7").Style.Font.Size = 20;

这些都不行;增加单元格字体大小的正确方法是什么?

None of this seems to work; what is the correct way to increase a cell's font size?

推荐答案

我不得不使用:

worksheet.get_Range("A7", "A7").Cells.Font.Size = 20;

这篇关于使用C#在excel中更改一个单元格的字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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