以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]导入Excel工资表的格式  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=151664)

--  作者:YDS
--  发布时间:2020/6/30 14:56:00
--  [求助]导入Excel工资表的格式
用ft开发企业微信自建应用
在导入Excel工资表的时候怎么判断表头有几行?
表头由合并列的时候如何知道合并的单元格是从哪一列到那一列?

--  作者:有点蓝
--  发布时间:2020/6/30 15:08:00
--  
没有办法判断表头有几行

合并单元格判断:http://foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=148030&skin=0

--  作者:YDS
--  发布时间:2020/6/30 17:10:00
--  

图片点击可在新窗口打开查看此主题相关图片如下:00.png
图片点击可在新窗口打开查看


Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\\1.xlsx")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Range("H1")
If Rg.MergeArea.Address = Rg.Address Then
    Output.Show(0)
Else
    Dim RowBegin As Integer = Rg.Cells(1).Row
    Dim RowEnd As Integer = Rg.Cells(Rg.Count).Row
    Output.Show(RowBegin)
    Output.Show(RowEnd)
    Dim ColumnBegin As Integer = Rg.MergeArea.Cells(1).Column
    Dim ColumnEnd As Integer = Rg.Columns.Count
    Output.Show(ColumnBegin)
    Output.Show(ColumnEnd)
End If

如何知道合并单元格从哪一行到哪一行?从那一列到那一列?

--  作者:有点蓝
--  发布时间:2020/6/30 17:28:00
--  
Dim Rg As MSExcel.Range = Ws.Range("H1")
Output.Show(rg.Address )
Output.Show(rg.MergeArea.Address )