English 中文(简体)
2. 在Word doc 内部改装嵌入式Excel物体
原标题:Modify an embedded Excel object inside a Word doc

我需要实例代码,甚至需要3个当事方的标语,使我能够接触一字的外壳物体。 我已经尝试过Aspose,他们还没有能力。 是否有任何人这样做,或知道有3个政党会反对吗?

问题回答

...... 我赞赏Remou的链接。 在我经历最初的障碍之后,它确实提供了一些支持。

我的守则是:

        WordApp.Documents.Open("C:Report.docx")
        Dim iOLE As Int16
        Dim oSheet As Object
        Dim oOLE As Object
        For iOLE = 1 To WordApp.ActiveDocument.Content.ShapeRange.Count  These are the embedded objects
            If Not WordApp.ActiveDocument.Content.ShapeRange(iOLE).OLEFormat Is Nothing Then  - make sure it is OLE
                If WordApp.ActiveDocument.Content.ShapeRange(iOLE).OLEFormat.ProgID.Contains("Excel") Then  - make sure it s an Excel object
                     - I have found an Excel Object!!!
                    WordApp.ActiveDocument.Content.ShapeRange(iOLE).OLEFormat.Activate()
                    oOLE = WordApp.ActiveDocument.Content.ShapeRange(iOLE).OLEFormat.Object
                    oSheet = oOLE.Worksheets(1)  - I can assert that each of them has at least one sheet and that I need the first one...
                    oSheet.Range("BB3") = "I did it!"  - setting some text to verify I made it in...

                End If

            End If

        Next

        WordApp.ActiveDocument.SaveAs("c:	emp
eport_test.docx")

您可在此找到一些信息:





相关问题
Is Shared ReadOnly lazyloaded?

I was wondering when I write Shared ReadOnly Variable As DataType = New DataType() Or alternatively Shared ReadOnly Variable As New DataType() Is it lazy loaded or as the instance initializes? ...

Entertaining a baby with VB.NET

I would like to write a little application in VB.NET that will detect a baby s cry. How would I get started with such an application?

Choose Enter Rather than Pressing Ok button

I have many fields in the page and the last field is a dropdown with list of values. When I select an item in a dropdown and press Enter, it doesn t do the "Ok". Instead I have to manually click on Ok ...

ALT Key Shortcuts Hidden

I am using VS2008 and creating forms. By default, the underscore of the character in a textbox when using an ampersand is not shown when I run the application. ex. "&Goto Here" is not ...

Set Select command in code

On button Click I want to Set the Select command of a Gridview. I do this and then databind the grid but it doesn t work. What am i doing wrong? protected void bttnView_Click(object sender, ...

Hover tooltip on specific words in rich text box?

I m trying to create something like a tooltip suddenly hoovering over the mouse pointer when specific words in the richt text box is hovered over. How can this be done?

热门标签