如何使用vb.net为合并的excel单元格中的单词加下划线 [英] How to underline a word in a merged excel cell using vb.net

查看:389
本文介绍了如何使用vb.net为合并的excel单元格中的单词加下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想强调这个词,我在一个由合并其他细胞组成的细胞中。我没有问题在单个单元格中强调单词而不是合并单元格。

任何帮助?



我尝试过:



我试过以下

 公开 oSheet 作为 Excel.Worksheet 
公共 oRng As Excel.Range
oRng = oSheet.Range( E& x, H& x)
oRng.MergeCells = True
oRng.Value = 倒计数
oRng.Range( E& x).Font .Underline = Excel.XlUnderlineStyle.xlUnderlineStyleSingle





 公共 oSheet 作为 Excel.Worksheet 
公共 oRng As Excel.Range
oRng = oSheet.Range( E& x, H& x)
oRng.MergeCells = True
oRng.Value = Count Back
oRng.Range( E & x, H& x).Font.Underline = Excel。 XlUnderlineStyle.xlUnderlineStyleSingle

解决方案

您的代码已关闭。当您尝试使用下划线时,请使用完整参考,而不仅仅是E列部分。这有效:

 oSheet.Range(  E & x,  H& x).Font.Underline = Excel。 XlUnderlineStyle.xlUnderlineStyleSingle 


I want to underline the word, I have in a cell that is made up by merging other cells. I have no problem underlining words in single cells but not merged cells.
Any help?

What I have tried:

I have tried the following

Public oSheet As Excel.Worksheet
Public oRng As Excel.Range
oRng = oSheet.Range("E" & x, "H" & x)
        oRng.MergeCells = True
        oRng.Value = "Count Back"
        oRng.Range("E" & x).Font.Underline = Excel.XlUnderlineStyle.xlUnderlineStyleSingle


and

Public oSheet As Excel.Worksheet
Public oRng As Excel.Range
oRng = oSheet.Range("E" & x, "H" & x)
        oRng.MergeCells = True
        oRng.Value = "Count Back"
        oRng.Range("E" & x, "H" & x).Font.Underline = Excel.XlUnderlineStyle.xlUnderlineStyleSingle

解决方案

Your code is close. When you try to underline use the full reference, not just the E column part. This works:

oSheet.Range("E" & x, "H" & x).Font.Underline = Excel.XlUnderlineStyle.xlUnderlineStyleSingle


这篇关于如何使用vb.net为合并的excel单元格中的单词加下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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