取消合并excel行和重复的数据c#

问题描述 投票:-1回答:1

此图像显示了我基本上想做的事情

enter image description hereUnmerge excel rows and duplicate data with c#enter image description here

我有很多需要在将数据插入SQL数据库之前准备的excel文件,步骤之一是取消合并excel单元并复制数据,我正在使用c#进行此文档解析我找到了VBA Macro Excel here

的解决方案
Sub UnMergeFill()
Dim cell As Range, joinedCells As Range
For Each cell In ThisWorkbook.ActiveSheet.UsedRange
    If cell.MergeCells Then
        Set joinedCells = cell.MergeArea
        cell.MergeCells = False
        joinedCells.Value = cell.Value
    End If
Next
End Sub

但是我需要使用microsoft.office.interop.excel在C#上完成有谁知道有没有办法做到这一点?

c# sql excel interop
1个回答
0
投票
C#代码非常相似:
© www.soinside.com 2019 - 2024. All rights reserved.