当前位置:编程学习 > C#/ASP.NET >>

继续问:C#读取word合并单元格后属性的读取

找到唯一的一个资源,可惜是VBA的,我看不懂,只会c#,请教高人帮我解释一下,最好翻译成c# 的一下!谢谢啦!

设置单元格的行列坐标并写的word文档中
Sub SetTablePosition()
    Dim tbl As Table
    Dim cell As cell
    Dim tblIndex As Integer
    Dim cellContent As String
    '以下遍历表格中存在的单元格
    For Each tbl In ThisDocument.Tables
        tblIndex = tblIndex + 1
        Row = 1
        col = 1
        Do While (1)
        Set cell = tbl.cell(Row, col)
        If Not cell Is Nothing Then    '如果单元格存在
            Debug.Print cell.RowIndex
            Debug.Print cell.ColumnIndex
            
            'TO-DO**********************************************************************
            cell.Select
            cellContent = Selection.Text
            'If Len(Trim(content)) <> 0 Then GoTo nextCell
            Selection.Text = "p" & Selection.Information(wdActiveEndPageNumber) _
                & "t" & tblIndex & "r" & Row & "c" & col
            'END**********************************************************************
            
            Set cell = tbl.cell(cell.RowIndex, cell.ColumnIndex).Next
            If cell Is Nothing Then Exit Do
            cell.Select
            Row = cell.RowIndex
            col = cell.ColumnIndex
            Set cell = tbl.cell(Row, col)
        Else
            Exit Do
        End If
nextCell: Loop
    Next
End Sub 
来源于:http://blog.csdn.net/WV1124/archive/2008/11/02/3207066.aspx --------------------编程问答-------------------- --------------------编程问答-------------------- 有没有哪位兄弟能帮我解决一个WORD里的不规则表格,该怎么读取,怎么判断,合并过的单元格和拆分过单元格,把这个不规则表格转换成HTML语言,我的邮件ndscwsy@tom.com,大家探讨一下
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,