473,756 Members | 5,129 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 1580

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
4341
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
1577
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
3258
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
3232
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
2715
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
9455
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
9271
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
9869
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9838
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8709
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
7242
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
6534
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();...
0
5140
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3805
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

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.