使用vb.net仅为excel范围中的数据单元添加边框 [英] add borders for only data cells in an excel range with vb.net

查看:206
本文介绍了使用vb.net仅为excel范围中的数据单元添加边框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好编码员,



我正在生成一个excel报告并在显示给用户之前格式化它。

我想申请边框所有有数据的单元格。(空数据单元除外)

我想知道有没有任何方法可以获取数据单元的集合来应用边框,而不是使用条件格式?



提前致谢

Hi coders,

I am generating an excel report and formatting it before showing to user.
I want to apply borders for all cells that have data.(except empty data cells)
I would like to know that is there any method to get collection of data cells to apply borders, instead of using conditional formatting?

Thanks in advance

推荐答案

1。 Interop:

单元格,范围包含数据: UsedRange [ ^ ]。添加边框的最简单方法是使用: Range.BorderAround方法 [ ^ ]。 边框 [ ^ ]可以用许多 LineStyle [ ^ ]。



更多:从.NET开发人员的角度理解Excel对象模型 [ ^ ]



2. OpenXML

Borders [ ^ ]和边框 [ ^ ];)
1. Interop:
Cells, range which have data: UsedRange[^]. The simplest way to add borders is to use: Range.BorderAround Method[^]. Borders[^] can be formatted with many LineStyle[^].

More: Understanding the Excel Object Model from a .NET Developer's Perspective[^]

2. OpenXML
Borders[^] and Border[^] ;)


这篇关于使用vb.net仅为excel范围中的数据单元添加边框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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