473,769 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

copy the selective html content & paste it in Excel 2007 programmaticall y (Vb.net)

2 New Member
I've a form where an webrowser contains a html file. I want to copy a selective portion of the html content and paste that content in an excel 2007 file where it will be pasted as a normal text (not in HTML code). I want to have the excel part should be as it is done manually (i.e. it should be in proper format as it is in the HTML file).

Platform/OS/Version : GUI/Windows XP/2005
Language :Vb.Net

Expand|Select|Wrap|Line Numbers
  1. Private Sub frmParse_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2.         WebBrowser1.Navigate(New Uri("http://sec.gov/Archives/edgar/data/1089951/000119312508074840/0001193125-08-074840-index.htm"))
  3. End Sub
  4.  
  5. Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
  6.         Dim sr As StreamReader = New StreamReader(WebBrowser1.DocumentStream)
  7.         Dim xlAppOut As Excel.Application
  8.         Dim xlBookOut As Excel.Workbook
  9.         Dim xlSheet1 As Excel.Worksheet
  10.         xlAppOut = CreateObject("Excel.Application")
  11.         xlBookOut = xlAppOut.Workbooks.Add
  12.         xlSheet1 = xlBookOut.Worksheets.Item(1)
  13.         xlAppOut.Visible = True
  14.         Clipboard.Clear()
  15.         Dim strContent As String = GetSelection(WebBrowser1)
  16.         Clipboard.SetText(strContent)
  17.         xlSheet1.Paste()
  18. End Sub
  19.  
  20. Private Function GetSelection(ByVal webBrowser As WebBrowser) As String
  21.         GetSelection = ""
  22.         Dim doc As IHTMLDocument2 = CType(webBrowser.Document.DomDocument, IHTMLDocument2)
  23.         Dim sel As IHTMLSelectionObject = doc.selection
  24.         Dim range As IHTMLTxtRange = CType(sel.createRange, IHTMLTxtRange)
  25.         GetSelection = range.htmlText
  26. End Function
  27.  
May 6 '08 #1
0 1582

Sign in to post your reply or Sign up for a free account.

Similar topics

2
10031
by: bill | last post by:
Hi All, When I send html content with Excel MIME type, the page break style sheet {page-break-before: always} doesn't work at Excel spreadsheet. Any idea to convert html page break style sheet to Excel page break? Thanks in advance
5
4343
by: tabonni | last post by:
Hello All I am creating an ASP page. There are a list of filename and checkbox next to it. When user checked all the documents they want and click ADD TO CLIPBOARD button. All filepaths will be copied into clipboard and then they can right-click -> paste into MS Outlook as attachments. How can I use clipboardData.setData function to do that? I saw a lot of examples they are just copy and paste text.
0
1578
by: arindams | last post by:
I'm getting problem in pasting HTML text in Excel 2007 whereas it is working fine in Excel 2003. The data pasted in excel 2007 is showing the the HTML code which is not desired. I need to have the text element as normal copy from HTML file in web browser is pasted in the opened excel cell (manual operation). I'm enclosing the code I've written in the following : Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As...
9
3260
by: AGP | last post by:
I have a VB6 application that has an OLE container with an embedded Excel chart. Our office updated to Excel 2007 and now although the app works the charts looks like crap. Since the app is fairly large my goal is to keep the devlopement in VB6 but am open to any ideas or suggestions. What i want to do is: 1. Keep my app in VB6 and find a workaround for the crappy looking charts. the charts now look very blocky and the grid lines and...
0
3294
by: =?Utf-8?B?ZGlzcGxheW5hbWU=?= | last post by:
The following code used to outputs to Excel 2003 fine. Do I need to change it to output to Excel 2007? <% Response.ContentType = "application/vnd.ms-excel" Response.AddHeader "Content-Disposition", "attachment; filename=List.xls" %> In addition, it pops a small File Download - Security Warning window showing the Name: List.xls Type: MS Excel 97-2003 Worksheet, 2.66 MB
2
3299
by: deepadevid | last post by:
Hi, when I tried to copy a worksheet programmatically in Excel 2007 the chartObjects are not getting copied. I am getting empty charts inside my new worksheet. This is working in Excel 2003. Excel.Application.Worksheets("Sheet1").ChartObjects.Count //I am getting 2 here. Excel.Application.worksheets("Sheet1").Copy After:= Excel.Application.Worksheets("Sheet2") Excel.Application.Worksheets("Sheet1 (2)").ChartObjects.Count // I am...
8
3233
by: K Viltersten | last post by:
I understand that the new versions of MS Word, MS Excel etc. allow for creation of a document using XML tags (the technique or format is called OOXML, i think). I imagine that the idea behind such creation resembles principally the way of creating a GUI using WPF, where one can mark up what parts of the text mass should carry this or that format etc.
4
2717
by: rshin2020 | last post by:
How do I convert data/information from C#.net language to Excel 2007 spreadsheet to be displayed? I have no clear idea at all how this is going to take place. If the codes are given, how do i test them? Is it just copy and paste? I'm very new to C#.net as i just started reading. Because of work purpose, I need a quick guide as to how to solve this. Need some help asap. Thanks.
0
1331
by: Puffy | last post by:
Using C#, I need to copy the contents of one worksheet (Excel.Worksheet) to another worksheet. Everything gets copied (including pivot charts) when I execute the code for the 1st time. But when I execute the code again, the charts (pivot charts) in the source worksheet dont get copied to the destination worksheet in Excel 2007. This works fine in Excel 2003. I'm using .NET 2.0! can you please help me on this... this is the code I'm using; ...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10210
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7406
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.