帮人忙,自己刚学vb.net,做一个小程序在vb.net中,导入ppt文件,左边list控件显示ppt中每页的标题,右侧textbox控件显示每个ppt页(slide) 中,所有元素的特性(字的大小,字体,颜色,等等),并把右侧的textbox的内容导出到excel文件中,每次打开不同的ppt文件后,导出到 excel表格,不覆盖以前的内容.
程序已能实现读取ppt文件,并在list和textbox中显示有关信息,现在需将textbox中的信息导出到excel表格中,请高手指点.在线等,今晚就要给人弄出来.如:在textbox中有如下信息
(2050) Rectangle 2 <PlaceHolder>
(X,Y)=(84,144) (Height,Width)=(90,546)
Forecolor=(0,228,168) Backcolor=(255,255,255)
Font=华文隶书 Size=44
第二章(3)
-------怎样把这些 分别放入excel单元格内???---
解决马上结贴,在线等

解决方案 »

  1.   

    1.添加excel reference
    2.创建excel 对象, 然后是wookbook, worksheet
    3.然后就是操作了
    以下是我曾经写的一个例子,希望有所帮助
            Dim xl As New Excel.Application, xlsheet As Excel.Worksheet
            Dim sFilePath As String        
            sFilePath = "D:\Big F\show.xls"
            xlsheet = xl.Workbooks.Open(sFilePath).ActiveSheet
            xlsheet.Cells(5, 2) = s.sDate.Date
            xlsheet.Cells(34, 2) = Format(s.FireTime, "HH:mm:00")
      

  2.   

    代码写了一些,就是把textbox中的数据 分别放入单元格,怎么操作。Private Sub ExportSlideInfo(ByVal iNumber As Integer)Dim m_Shapes As Hashtable
    m_Shapes = New Hashtable
    Dim oEnum As IDictionaryEnumeratoroEnum = m_Shapes.Keys.GetEnumerator()
    oEnum.Reset()
    Dim oShape As cShapeDim iIndex As Integer
    Dim iii As IntegerDim xlApp = CType(CreateObject("Excel.Application"), _
    Microsoft.Office.Interop.Excel.Application)
    Dim xlBook = CType(xlApp.Workbooks.Add, _
    Microsoft.Office.Interop.Excel.Workbook)
    Dim xlSheet = CType(xlBook.Worksheets(1), _
    Microsoft.Office.Interop.Excel.Worksheet)xlSheet.Application.Visible = True
    xlSheet.Range("B1").Value = "Text size"xlSheet.Range("C1").Value = "Text font"xlSheet.Range("D1").Value = "Lines in one slide"xlSheet.Range("E1").Formula = "Fore Color"
    iii = 5
    xlSheet.SaveAs("C:\Documents and Settings\Administrator.MINGSUN\桌面\SlideView(1)\SlideView\results.xls")
      

  3.   

    问题差不多快解决了,问问各位,在textbox中把所有信息显示在一行怎么写代码,
    本来是这样写的
    sStr = Split(m_Text, vbCrLf)
       For i = LBound(sStr) To UBound(sStr)
         sRet = sRet + vbCrLf + sSpace + sStr(i) + "(" + CStr(Len(sStr(i))) + ")"
       Next
    ---这样写后textbox中的数据多行显示了
      

  4.   

    你把textbox属性multiline设置成false就好了