accessing document object model (DOM) using vb and asp.net

R

Randall Arnold

I've got an asp.net page that dynamically generates an html table on the
server side. On the client side, I need to copy the rendered table to the
clipboard programmatically (using vbscript). I just need to be pointed
toward a resource for accessing the DOM this way. I must be searching on
the wrong keywords because so far I can't find anything helpful, even on
Microsoft's site.

My development environment is Visual Web developer Express 2005. Thanks,

Randall Arnold
 
R

Randall Arnold

Thanks for the advice, Ken, and I'll give that a shot.

Personally, I'd prefer to do this using VB.NET on the server side but cannot
for the life of me figure it out or find any resources that will help. Is
it even possible to, say, select an html table after the page has rendered
and copy it to the clipboard this way? Seems to me it should be...

Randall
 
M

m.posseth

well i do not believe it is possible to copy this info direct from the
webbrowser to a local systems clipboard ( would be new to me )

however it should be verry easy to do this with your own webclient ,,,,
i.ow. a program that you write to access this generated report
this could even be a webbrowser control on a vb form through the vb form you
can now access both the HTML DOM in the webrbrowser control and the
clipboard

another way would be to use a webclient strip the required data from the
page and copy this to the clipboard

regards

regards

Michel Posseth [MCP]
 
R

Randall Arnold

Guess I should have viewed the link before I replied.

I've already tried the method mentioned there with no success. So far,
using that technique combined with other methods, the best I've been able to
do is grab the table's html code, save it to a file, open it in Word, copy
the table to the clipboard from there, and then paste it into Powerpoint
(the intended destination). This is crude and prone to error-- Powerpoint
crashes if I attempt to paste the table (I'm assuming based on
troubleshooting that there is a timing problem, ie, events still processing
when I try the paste method). So the only way to get it to "work" is a
two-fold operation, where one button click creates the html and performs the
copy to clipboard and the second button click creates a Powerpoint instance
and copies the clipboard contents to a slide. I can't figure out how to
check the state of events to make this a one-click operation-- but then, I
don't like this insane workaround anyway.

If I use the example cited with no further massaging, all I end up with is
raw html pasted into Powerpoint instead of a table object.

This is extremely frustrating. What I thought would be a ridiculously easy
endeavor has turned into a MAJOR showstopper for migrating my department's
VB6 app to ASP.NET/VB.NET. One simple table copy/paste snafu is preventing
deployment of a significant improvement to the way we conduct business. I'm
flabbergasted to put it mildly. Previous requests for help in other forums
have gone unanswered, so I guess I've (sigh) once again stumped Microsoft...

Randall
 
R

Randall Arnold

Thanks Cor.

I hadn't googled those terms because that wasn't my first choice of
methods... but based on what little I've turned up so far it may be all I
can do. I'm much more familiar with vb than javascript and try to stay with
what I'm familiar with... especially since, given the fact I'm encountering
difficulty doing something I thought would be simple in VB, it's likely to
frustrate me 10 times as much in another language I rarely use.

All I want to do is programmatically copy a specific html table from an
asp.net page to a Powerpoint slide. If I'd known it was going to become
such a freaking nightmare I'd have never mentioned ASP.NET as a solution to
my boss. The platform is not ready for prime time IMO, and that's really
sad.

I should have stuck with Windows forms...

Randall
 
C

Chris Dunaway

You can use the same method with VBScript. Instead of JavaScript, code
VBScript.
 
R

Randall Arnold

Thanks, but I can't even see how to select the Table programmatically so
that it can be copied to the clipboard. So far not one method other than
the crude one I'm currently using has worked.

Randall
 
C

Cor Ligthert [MVP]

Chis,

See the comment from Ken about that which I of course completely deal.

:)

Cor
 
R

Randall Arnold

This is an intranet solution so the point about vbscript compatibility is
actually moot-- the company uses IE almost exclusively.

But the issue itself is practically moot, anyway. I'm more frustrated now
than ever even after the recent suggestions. I just can't see how this can
be done, and IMO it should be extremely simple.

20 years of programming, using a variety of languages, on multiple
platforms, and I've NEVER encountered this much trouble getting something so
basic to work. Copying an object from a web page to an open document should
NOT be impossible or even moderately difficult.

I am about to join the other developers who have sworn off ASP.NET for
PHP... this is for the birds. : (

Randall Arnold
 
C

Chris Dunaway

I think the angle you may have to work from is to use PowerPoint
interop to import a slide from an .html file. You can use the
WebRequest class to get the .html by accessing the .asp then insert a
slide into PowerPoint from the resulting .html.

I am not familiar with PowerPoint interop to know how to do that,
however.
 
R

Randall Arnold

The Powerpoint end of things is no problem for me-- it's the OTHER parts of
your suggestion that get me lost. I wouldn't even know where to start
figuring out how to get the html from an asp page-- in fact, I posed that
question on another forum and the responses so far are wayyyy over my head
(and pertain to C# anyway).

This is depressing.

Randall
 
C

Cor Ligthert [MVP]

Randall,

Web applications *where* great to work with.

Security has however removed this *great* to a situation where almost
everything that you think that you would do is not possible anymore. The
Rich Client can in your situation as you now describe it a way to go.

http://msdn.microsoft.com/msdnmag/issues/02/06/rich/default.aspx

This is however not for the open web as are ActiveX compenents impossible to
use because allmost non users will allow to use them if they are not
completely sure that it is from you and they know you.

I hope this gives some ideas.

Cor
 
R

Randall Arnold

Thanks Cor, I'll look into this.

What irks me is there does not seem to be a trusted intranet model that
would allow me to disregard security hindrances that don't apply. In other
words, if I want to enable 100% clipboard access in intranet-only
situations, I believe I should have that ability. I don't like MS (or any
other company) forcing a "one size fits all" security model on us as
developers.

Randall Arnold
 
C

Cor Ligthert [MVP]

Randall,

I would in your case in one of the security newsgroups.

There seems to be a lot of possibilities for that in an Intranet situation,
however I never tried them. The keyword is AFAIK personalize.

I hope this helps,

Cor
 
R

Rahul Parundekar

Hi.
I am a student from VIT college Pune, India
i am developing a project for a competition which has to read a table
generated by an asp page and store it to a local database using vb6.
it seems to be similar to what you are doing.
i tried inet,webbrowser,url methods etc, but the page saved has no
table in its source... only a </table> tag
i was wondering if you found a way to grab a table from an asp
page.....
please reply to me at (e-mail address removed)
the project basically aims at interfacing a mobile phone to the pc...
and using the data in the table to send via sms on query....
 
A

Alex Ataev

Hi Randal and Rahul!

I have a very similar situation. I need to read data programmatically
(VBA) from web page into MS Access application. I'm also using a web
browser control on Access form. Control does show a web page, supports
navigation, but how to read data programmatically from there?
Did you find finally any solution for this problem?

If so, please let me know.
Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top