|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
programmatically copy table to another applicationI'd give it one more try here. I want to programmatically select an html table rendered on an aspx page (using VB) and copy it to another application (Word, Powerpoint, Excel, et al)... probably using the Windows clipboard. So far I have a really crude method that involves saving the table as an html file, reloading it in Word, copying table to clipboard, etc etc etc-- but *surely* there has to be a more elegant method, ie, accessing the table as an object right off the web page and copying it from there. Problem is, I can't find a single example of how to do this and the few suggestions I've received aren't helpful. So one last gasp: anyone here have any ideas? Thanks, Randall Arnold Randall,
if the functionality you require is for someone to copy-and-paste a table from the website to word, this should be inherently supported with IE. my recommendation though would be to binary write the html for the table to the client, but change the ContentType to application/vnd-msword or application/vnd-msexcel. ive found by binary writing directly to these applications and letting the os handle which program to open (hopefully word and excel), the html comes out just fine, without the need to save files or use the windows clipboard. let me know if this helps, Mike MacMillan Randall Arnold wrote: Show quoteHide quote > I'm about to give up on what I thought would be a simple effort but figured > I'd give it one more try here. > > I want to programmatically select an html table rendered on an aspx page > (using VB) and copy it to another application (Word, Powerpoint, Excel, et > al)... probably using the Windows clipboard. > > So far I have a really crude method that involves saving the table as an > html file, reloading it in Word, copying table to clipboard, etc etc etc-- > but *surely* there has to be a more elegant method, ie, accessing the table > as an object right off the web page and copying it from there. Problem is, > I can't find a single example of how to do this and the few suggestions I've > received aren't helpful. > > So one last gasp: anyone here have any ideas? > > Thanks, > > Randall Arnold Mike:
Your solution looks more like what I want to do than any other I've come across, thought of or been told to try. Unfortunately, I lack experience in this area (binary writes). However, I'll certainly research it because everything else has failed miserably and I've almost given up getting this to work. All I really want is an asp.net web application that presents tables and charts of quality reports, and allow users to publish them in formats with which they are accustomed (Word, Powerpoint, et al). I never in my wildest dreams imagined it'd be as difficult an effort as it has turned out to be. I hope I can make your suggestion work. Thanks, Randall Show quoteHide quote "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message news:1135883389.449325.248080@g49g2000cwa.googlegroups.com... > Randall, > if the functionality you require is for someone to copy-and-paste a > table from the website to word, this should be inherently supported > with IE. my recommendation though would be to binary write the html > for the table to the client, but change the ContentType to > application/vnd-msword or application/vnd-msexcel. ive found by binary > writing directly to these applications and letting the os handle which > program to open (hopefully word and excel), the html comes out just > fine, without the need to save files or use the windows clipboard. > > let me know if this helps, > Mike MacMillan > > > Randall Arnold wrote: >> I'm about to give up on what I thought would be a simple effort but >> figured >> I'd give it one more try here. >> >> I want to programmatically select an html table rendered on an aspx page >> (using VB) and copy it to another application (Word, Powerpoint, Excel, >> et >> al)... probably using the Windows clipboard. >> >> So far I have a really crude method that involves saving the table as an >> html file, reloading it in Word, copying table to clipboard, etc etc >> etc-- >> but *surely* there has to be a more elegant method, ie, accessing the >> table >> as an object right off the web page and copying it from there. Problem >> is, >> I can't find a single example of how to do this and the few suggestions >> I've >> received aren't helpful. >> >> So one last gasp: anyone here have any ideas? >> >> Thanks, >> >> Randall Arnold > Randall,
ive included a simple page that binary writes the rendered html of a table to the client using the contentType application/msword. obviously, this is the most basic example, but should be enough to get you going. let me know if you have any questions. <%@ page language="c#" inherits="System.Web.UI.Page" autoEventWireup="true" %> <%@ import namespace="System.IO" %> <%@ import namespace="System.Text" %> <%@ import namespace="System.Web.UI" %> <script runat="server"> void OnExportData(object sender, EventArgs e) { StringWriter sw; HtmlTextWriter html; byte[] arStuff; //** create our output stream and htmltextwriter sw = new StringWriter(); html = new HtmlTextWriter(sw); //** get the table's rendered content tblStuff.RenderControl(html); sw.Flush(); //** get the byte array of the html output arStuff = Encoding.ASCII.GetBytes(sw.ToString()); //** set the contentType and binary write to the client Response.Clear(); Response.ContentType = "application/msword"; Response.AddHeader("Content-Disposition", "inline"); Response.AddHeader("Content-Length", ""+ arStuff.Length); Response.BinaryWrite(arStuff); Response.End(); } </script> <html> <head> <style type="text/css"> tr.columnHeaders td { background-color: #eee; font-weight: bold; } </style> </head> <body> <form runat="server"> <table border="0" width="100%" cellpadding="2" cellspacing="0" id="tblStuff" runat="server"> <tr class="columnHeaders"> <td>Column 1</td> <td>Column 2</td> <td>Column 3</td> <td>Column 4</td> </tr> <tr> <td>test data 01</td> <td>test data 02</td> <td>test data 03</td> <td>test data 04</td> </tr> <tr> <td>test data 11</td> <td>test data 12</td> <td>test data 13</td> <td>test data 14</td> </tr> <tr> <td>test data 21</td> <td>test data 22</td> <td>test data 23</td> <td>test data 24</td> </tr> <tr> <td>test data 31</td> <td>test data 32</td> <td>test data 33</td> <td>test data 34</td> </tr> </table> <asp:Button id="btnExport" text="Export Data" onclick="OnExportData" runat="server"/> </form> </body> </html> hope this helps, Mike MacMillan Randall Arnold wrote: Show quoteHide quote > Mike: > > Your solution looks more like what I want to do than any other I've come > across, thought of or been told to try. Unfortunately, I lack experience in > this area (binary writes). However, I'll certainly research it because > everything else has failed miserably and I've almost given up getting this > to work. > > All I really want is an asp.net web application that presents tables and > charts of quality reports, and allow users to publish them in formats with > which they are accustomed (Word, Powerpoint, et al). I never in my wildest > dreams imagined it'd be as difficult an effort as it has turned out to be. > I hope I can make your suggestion work. Thanks, > > Randall > > "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message > news:1135883389.449325.248080@g49g2000cwa.googlegroups.com... > > Randall, > > if the functionality you require is for someone to copy-and-paste a > > table from the website to word, this should be inherently supported > > with IE. my recommendation though would be to binary write the html > > for the table to the client, but change the ContentType to > > application/vnd-msword or application/vnd-msexcel. ive found by binary > > writing directly to these applications and letting the os handle which > > program to open (hopefully word and excel), the html comes out just > > fine, without the need to save files or use the windows clipboard. > > > > let me know if this helps, > > Mike MacMillan > > > > > > Randall Arnold wrote: > >> I'm about to give up on what I thought would be a simple effort but > >> figured > >> I'd give it one more try here. > >> > >> I want to programmatically select an html table rendered on an aspx page > >> (using VB) and copy it to another application (Word, Powerpoint, Excel, > >> et > >> al)... probably using the Windows clipboard. > >> > >> So far I have a really crude method that involves saving the table as an > >> html file, reloading it in Word, copying table to clipboard, etc etc > >> etc-- > >> but *surely* there has to be a more elegant method, ie, accessing the > >> table > >> as an object right off the web page and copying it from there. Problem > >> is, > >> I can't find a single example of how to do this and the few suggestions > >> I've > >> received aren't helpful. > >> > >> So one last gasp: anyone here have any ideas? > >> > >> Thanks, > >> > >> Randall Arnold > > Wow! you sure went to a lot of effort there and I really appreciate it.
Just hope it works! What's extremely frustrating for me here is that one line of code is all it takes to get my chart object to the clipboard, to wit: Clipboard.SetImage(Chart1.GetChartBitmap) After that, a simple paste operation gets it into Powerpoint: objPres.Slides(1).Shapes.PasteSpecial(Microsoft.Office.Interop.PowerPoint.PpPasteDataType.ppPasteBitmap, Microsoft.Office.Core.MsoTriState.msoFalse) That was all I was looking for, but darned if I could make the quivalent method (SetDataObject) work for an html table. I'm still blown away by the fact that Microsoft made this so difficult! But maybe I shouldn't be by now. Anyway, I'll give your suggestion a shot! Thanks again. Randall Show quoteHide quote "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message news:1135888227.325139.217280@g49g2000cwa.googlegroups.com... > Randall, > ive included a simple page that binary writes the rendered html of a > table to the client using the contentType application/msword. > obviously, this is the most basic example, but should be enough to get > you going. let me know if you have any questions. > > <%@ page language="c#" inherits="System.Web.UI.Page" > autoEventWireup="true" %> > <%@ import namespace="System.IO" %> > <%@ import namespace="System.Text" %> > <%@ import namespace="System.Web.UI" %> > > <script runat="server"> > void OnExportData(object sender, EventArgs e) { > StringWriter sw; > HtmlTextWriter html; > byte[] arStuff; > > //** create our output stream and htmltextwriter > sw = new StringWriter(); > html = new HtmlTextWriter(sw); > > //** get the table's rendered content > tblStuff.RenderControl(html); > sw.Flush(); > > //** get the byte array of the html output > arStuff = Encoding.ASCII.GetBytes(sw.ToString()); > > //** set the contentType and binary write to the client > Response.Clear(); > Response.ContentType = "application/msword"; > Response.AddHeader("Content-Disposition", "inline"); > Response.AddHeader("Content-Length", ""+ arStuff.Length); > Response.BinaryWrite(arStuff); > Response.End(); > } > </script> > > <html> > <head> > <style type="text/css"> > tr.columnHeaders td { background-color: #eee; font-weight: bold; } > </style> > </head> > <body> > <form runat="server"> > > <table border="0" width="100%" cellpadding="2" cellspacing="0" > id="tblStuff" runat="server"> > <tr class="columnHeaders"> > <td>Column 1</td> > <td>Column 2</td> > <td>Column 3</td> > <td>Column 4</td> > </tr> > > <tr> > <td>test data 01</td> > <td>test data 02</td> > <td>test data 03</td> > <td>test data 04</td> > </tr> > > <tr> > <td>test data 11</td> > <td>test data 12</td> > <td>test data 13</td> > <td>test data 14</td> > </tr> > > <tr> > <td>test data 21</td> > <td>test data 22</td> > <td>test data 23</td> > <td>test data 24</td> > </tr> > > <tr> > <td>test data 31</td> > <td>test data 32</td> > <td>test data 33</td> > <td>test data 34</td> > </tr> > </table> > > <asp:Button id="btnExport" text="Export Data" onclick="OnExportData" > runat="server"/> > > </form> > </body> > </html> > > > > hope this helps, > Mike MacMillan > > > Randall Arnold wrote: >> Mike: >> >> Your solution looks more like what I want to do than any other I've come >> across, thought of or been told to try. Unfortunately, I lack experience >> in >> this area (binary writes). However, I'll certainly research it because >> everything else has failed miserably and I've almost given up getting >> this >> to work. >> >> All I really want is an asp.net web application that presents tables and >> charts of quality reports, and allow users to publish them in formats >> with >> which they are accustomed (Word, Powerpoint, et al). I never in my >> wildest >> dreams imagined it'd be as difficult an effort as it has turned out to >> be. >> I hope I can make your suggestion work. Thanks, >> >> Randall >> >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message >> news:1135883389.449325.248080@g49g2000cwa.googlegroups.com... >> > Randall, >> > if the functionality you require is for someone to copy-and-paste a >> > table from the website to word, this should be inherently supported >> > with IE. my recommendation though would be to binary write the html >> > for the table to the client, but change the ContentType to >> > application/vnd-msword or application/vnd-msexcel. ive found by binary >> > writing directly to these applications and letting the os handle which >> > program to open (hopefully word and excel), the html comes out just >> > fine, without the need to save files or use the windows clipboard. >> > >> > let me know if this helps, >> > Mike MacMillan >> > >> > >> > Randall Arnold wrote: >> >> I'm about to give up on what I thought would be a simple effort but >> >> figured >> >> I'd give it one more try here. >> >> >> >> I want to programmatically select an html table rendered on an aspx >> >> page >> >> (using VB) and copy it to another application (Word, Powerpoint, >> >> Excel, >> >> et >> >> al)... probably using the Windows clipboard. >> >> >> >> So far I have a really crude method that involves saving the table as >> >> an >> >> html file, reloading it in Word, copying table to clipboard, etc etc >> >> etc-- >> >> but *surely* there has to be a more elegant method, ie, accessing the >> >> table >> >> as an object right off the web page and copying it from there. >> >> Problem >> >> is, >> >> I can't find a single example of how to do this and the few >> >> suggestions >> >> I've >> >> received aren't helpful. >> >> >> >> So one last gasp: anyone here have any ideas? >> >> >> >> Thanks, >> >> >> >> Randall Arnold >> > > Randall,
i noticed you're using the PowerPoint object directly. another suggestion then might be to use the COM object's for office to build a word doc (or whatever format) on the server side, then send it to the client via the binary write sample from earlier. you can accomplish this using the Office PIAs (primary interop assemblies): http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en also, make sure you read through the known issues first so you avoid spinning your wheels: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_piaissues.asp hope this helps, Mike MacMillan Randall Arnold wrote: Show quoteHide quote > Wow! you sure went to a lot of effort there and I really appreciate it. > Just hope it works! > > What's extremely frustrating for me here is that one line of code is all it > takes to get my chart object to the clipboard, to wit: > > Clipboard.SetImage(Chart1.GetChartBitmap) > > After that, a simple paste operation gets it into Powerpoint: > > objPres.Slides(1).Shapes.PasteSpecial(Microsoft.Office.Interop.PowerPoint.PpPasteDataType.ppPasteBitmap, > Microsoft.Office.Core.MsoTriState.msoFalse) > > That was all I was looking for, but darned if I could make the quivalent > method (SetDataObject) work for an html table. I'm still blown away by the > fact that Microsoft made this so difficult! But maybe I shouldn't be by > now. > > Anyway, I'll give your suggestion a shot! Thanks again. > > Randall > > > "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message > news:1135888227.325139.217280@g49g2000cwa.googlegroups.com... > > Randall, > > ive included a simple page that binary writes the rendered html of a > > table to the client using the contentType application/msword. > > obviously, this is the most basic example, but should be enough to get > > you going. let me know if you have any questions. > > > > <%@ page language="c#" inherits="System.Web.UI.Page" > > autoEventWireup="true" %> > > <%@ import namespace="System.IO" %> > > <%@ import namespace="System.Text" %> > > <%@ import namespace="System.Web.UI" %> > > > > <script runat="server"> > > void OnExportData(object sender, EventArgs e) { > > StringWriter sw; > > HtmlTextWriter html; > > byte[] arStuff; > > > > //** create our output stream and htmltextwriter > > sw = new StringWriter(); > > html = new HtmlTextWriter(sw); > > > > //** get the table's rendered content > > tblStuff.RenderControl(html); > > sw.Flush(); > > > > //** get the byte array of the html output > > arStuff = Encoding.ASCII.GetBytes(sw.ToString()); > > > > //** set the contentType and binary write to the client > > Response.Clear(); > > Response.ContentType = "application/msword"; > > Response.AddHeader("Content-Disposition", "inline"); > > Response.AddHeader("Content-Length", ""+ arStuff.Length); > > Response.BinaryWrite(arStuff); > > Response.End(); > > } > > </script> > > > > <html> > > <head> > > <style type="text/css"> > > tr.columnHeaders td { background-color: #eee; font-weight: bold; } > > </style> > > </head> > > <body> > > <form runat="server"> > > > > <table border="0" width="100%" cellpadding="2" cellspacing="0" > > id="tblStuff" runat="server"> > > <tr class="columnHeaders"> > > <td>Column 1</td> > > <td>Column 2</td> > > <td>Column 3</td> > > <td>Column 4</td> > > </tr> > > > > <tr> > > <td>test data 01</td> > > <td>test data 02</td> > > <td>test data 03</td> > > <td>test data 04</td> > > </tr> > > > > <tr> > > <td>test data 11</td> > > <td>test data 12</td> > > <td>test data 13</td> > > <td>test data 14</td> > > </tr> > > > > <tr> > > <td>test data 21</td> > > <td>test data 22</td> > > <td>test data 23</td> > > <td>test data 24</td> > > </tr> > > > > <tr> > > <td>test data 31</td> > > <td>test data 32</td> > > <td>test data 33</td> > > <td>test data 34</td> > > </tr> > > </table> > > > > <asp:Button id="btnExport" text="Export Data" onclick="OnExportData" > > runat="server"/> > > > > </form> > > </body> > > </html> > > > > > > > > hope this helps, > > Mike MacMillan > > > > > > Randall Arnold wrote: > >> Mike: > >> > >> Your solution looks more like what I want to do than any other I've come > >> across, thought of or been told to try. Unfortunately, I lack experience > >> in > >> this area (binary writes). However, I'll certainly research it because > >> everything else has failed miserably and I've almost given up getting > >> this > >> to work. > >> > >> All I really want is an asp.net web application that presents tables and > >> charts of quality reports, and allow users to publish them in formats > >> with > >> which they are accustomed (Word, Powerpoint, et al). I never in my > >> wildest > >> dreams imagined it'd be as difficult an effort as it has turned out to > >> be. > >> I hope I can make your suggestion work. Thanks, > >> > >> Randall > >> > >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message > >> news:1135883389.449325.248080@g49g2000cwa.googlegroups.com... > >> > Randall, > >> > if the functionality you require is for someone to copy-and-paste a > >> > table from the website to word, this should be inherently supported > >> > with IE. my recommendation though would be to binary write the html > >> > for the table to the client, but change the ContentType to > >> > application/vnd-msword or application/vnd-msexcel. ive found by binary > >> > writing directly to these applications and letting the os handle which > >> > program to open (hopefully word and excel), the html comes out just > >> > fine, without the need to save files or use the windows clipboard. > >> > > >> > let me know if this helps, > >> > Mike MacMillan > >> > > >> > > >> > Randall Arnold wrote: > >> >> I'm about to give up on what I thought would be a simple effort but > >> >> figured > >> >> I'd give it one more try here. > >> >> > >> >> I want to programmatically select an html table rendered on an aspx > >> >> page > >> >> (using VB) and copy it to another application (Word, Powerpoint, > >> >> Excel, > >> >> et > >> >> al)... probably using the Windows clipboard. > >> >> > >> >> So far I have a really crude method that involves saving the table as > >> >> an > >> >> html file, reloading it in Word, copying table to clipboard, etc etc > >> >> etc-- > >> >> but *surely* there has to be a more elegant method, ie, accessing the > >> >> table > >> >> as an object right off the web page and copying it from there. > >> >> Problem > >> >> is, > >> >> I can't find a single example of how to do this and the few > >> >> suggestions > >> >> I've > >> >> received aren't helpful. > >> >> > >> >> So one last gasp: anyone here have any ideas? > >> >> > >> >> Thanks, > >> >> > >> >> Randall Arnold > >> > > > Thanks again. Your earlier method worked, although with some limitations.
I'll check the links you provided later. I had originally envisioned using the interops, but just can't figure out how they can help me get the table object from the asp.net page and into the target application. There's a serious lack of info out there on this, and people are even telling me it flat can't be done the way I want to do it (ie, simple and direct). if that's true, asp.net is seriously flawed IMO. Randall Show quoteHide quote "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message news:1135898403.675888.324850@g44g2000cwa.googlegroups.com... > Randall, > i noticed you're using the PowerPoint object directly. another > suggestion then might be to use the COM object's for office to build a > word doc (or whatever format) on the server side, then send it to the > client via the binary write sample from earlier. you can accomplish > this using the Office PIAs (primary interop assemblies): > > > http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en > > also, make sure you read through the known issues first so you avoid > spinning your wheels: > > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_piaissues.asp > > hope this helps, > Mike MacMillan > > > Randall Arnold wrote: >> Wow! you sure went to a lot of effort there and I really appreciate it. >> Just hope it works! >> >> What's extremely frustrating for me here is that one line of code is all >> it >> takes to get my chart object to the clipboard, to wit: >> >> Clipboard.SetImage(Chart1.GetChartBitmap) >> >> After that, a simple paste operation gets it into Powerpoint: >> >> objPres.Slides(1).Shapes.PasteSpecial(Microsoft.Office.Interop.PowerPoint.PpPasteDataType.ppPasteBitmap, >> Microsoft.Office.Core.MsoTriState.msoFalse) >> >> That was all I was looking for, but darned if I could make the quivalent >> method (SetDataObject) work for an html table. I'm still blown away by >> the >> fact that Microsoft made this so difficult! But maybe I shouldn't be by >> now. >> >> Anyway, I'll give your suggestion a shot! Thanks again. >> >> Randall >> >> >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message >> news:1135888227.325139.217280@g49g2000cwa.googlegroups.com... >> > Randall, >> > ive included a simple page that binary writes the rendered html of a >> > table to the client using the contentType application/msword. >> > obviously, this is the most basic example, but should be enough to get >> > you going. let me know if you have any questions. >> > >> > <%@ page language="c#" inherits="System.Web.UI.Page" >> > autoEventWireup="true" %> >> > <%@ import namespace="System.IO" %> >> > <%@ import namespace="System.Text" %> >> > <%@ import namespace="System.Web.UI" %> >> > >> > <script runat="server"> >> > void OnExportData(object sender, EventArgs e) { >> > StringWriter sw; >> > HtmlTextWriter html; >> > byte[] arStuff; >> > >> > //** create our output stream and htmltextwriter >> > sw = new StringWriter(); >> > html = new HtmlTextWriter(sw); >> > >> > //** get the table's rendered content >> > tblStuff.RenderControl(html); >> > sw.Flush(); >> > >> > //** get the byte array of the html output >> > arStuff = Encoding.ASCII.GetBytes(sw.ToString()); >> > >> > //** set the contentType and binary write to the client >> > Response.Clear(); >> > Response.ContentType = "application/msword"; >> > Response.AddHeader("Content-Disposition", "inline"); >> > Response.AddHeader("Content-Length", ""+ arStuff.Length); >> > Response.BinaryWrite(arStuff); >> > Response.End(); >> > } >> > </script> >> > >> > <html> >> > <head> >> > <style type="text/css"> >> > tr.columnHeaders td { background-color: #eee; font-weight: bold; } >> > </style> >> > </head> >> > <body> >> > <form runat="server"> >> > >> > <table border="0" width="100%" cellpadding="2" cellspacing="0" >> > id="tblStuff" runat="server"> >> > <tr class="columnHeaders"> >> > <td>Column 1</td> >> > <td>Column 2</td> >> > <td>Column 3</td> >> > <td>Column 4</td> >> > </tr> >> > >> > <tr> >> > <td>test data 01</td> >> > <td>test data 02</td> >> > <td>test data 03</td> >> > <td>test data 04</td> >> > </tr> >> > >> > <tr> >> > <td>test data 11</td> >> > <td>test data 12</td> >> > <td>test data 13</td> >> > <td>test data 14</td> >> > </tr> >> > >> > <tr> >> > <td>test data 21</td> >> > <td>test data 22</td> >> > <td>test data 23</td> >> > <td>test data 24</td> >> > </tr> >> > >> > <tr> >> > <td>test data 31</td> >> > <td>test data 32</td> >> > <td>test data 33</td> >> > <td>test data 34</td> >> > </tr> >> > </table> >> > >> > <asp:Button id="btnExport" text="Export Data" onclick="OnExportData" >> > runat="server"/> >> > >> > </form> >> > </body> >> > </html> >> > >> > >> > >> > hope this helps, >> > Mike MacMillan >> > >> > >> > Randall Arnold wrote: >> >> Mike: >> >> >> >> Your solution looks more like what I want to do than any other I've >> >> come >> >> across, thought of or been told to try. Unfortunately, I lack >> >> experience >> >> in >> >> this area (binary writes). However, I'll certainly research it >> >> because >> >> everything else has failed miserably and I've almost given up getting >> >> this >> >> to work. >> >> >> >> All I really want is an asp.net web application that presents tables >> >> and >> >> charts of quality reports, and allow users to publish them in formats >> >> with >> >> which they are accustomed (Word, Powerpoint, et al). I never in my >> >> wildest >> >> dreams imagined it'd be as difficult an effort as it has turned out to >> >> be. >> >> I hope I can make your suggestion work. Thanks, >> >> >> >> Randall >> >> >> >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message >> >> news:1135883389.449325.248080@g49g2000cwa.googlegroups.com... >> >> > Randall, >> >> > if the functionality you require is for someone to copy-and-paste a >> >> > table from the website to word, this should be inherently supported >> >> > with IE. my recommendation though would be to binary write the html >> >> > for the table to the client, but change the ContentType to >> >> > application/vnd-msword or application/vnd-msexcel. ive found by >> >> > binary >> >> > writing directly to these applications and letting the os handle >> >> > which >> >> > program to open (hopefully word and excel), the html comes out just >> >> > fine, without the need to save files or use the windows clipboard. >> >> > >> >> > let me know if this helps, >> >> > Mike MacMillan >> >> > >> >> > >> >> > Randall Arnold wrote: >> >> >> I'm about to give up on what I thought would be a simple effort but >> >> >> figured >> >> >> I'd give it one more try here. >> >> >> >> >> >> I want to programmatically select an html table rendered on an aspx >> >> >> page >> >> >> (using VB) and copy it to another application (Word, Powerpoint, >> >> >> Excel, >> >> >> et >> >> >> al)... probably using the Windows clipboard. >> >> >> >> >> >> So far I have a really crude method that involves saving the table >> >> >> as >> >> >> an >> >> >> html file, reloading it in Word, copying table to clipboard, etc >> >> >> etc >> >> >> etc-- >> >> >> but *surely* there has to be a more elegant method, ie, accessing >> >> >> the >> >> >> table >> >> >> as an object right off the web page and copying it from there. >> >> >> Problem >> >> >> is, >> >> >> I can't find a single example of how to do this and the few >> >> >> suggestions >> >> >> I've >> >> >> received aren't helpful. >> >> >> >> >> >> So one last gasp: anyone here have any ideas? >> >> >> >> >> >> Thanks, >> >> >> >> >> >> Randall Arnold >> >> > >> > > Randall,
> I had originally envisioned using keep in mind that any office docs u create/manipulate with the pia's> the interops, but just can't figure out how they can help me get the table > object from the asp.net page and into the target application are on the server side, not the client side. you're still bound by the limitations of http for sending data to the client. a solution for sending a single table might be to use the pia's to create a word doc, save it to a temp folder on the server, then send it to the client. this will allow you more direct control over what is built, rather then hoping word renders your html correctly. Mike MacMillan Randall Arnold wrote: Show quoteHide quote > Thanks again. Your earlier method worked, although with some limitations. > I'll check the links you provided later. I had originally envisioned using > the interops, but just can't figure out how they can help me get the table > object from the asp.net page and into the target application. There's a > serious lack of info out there on this, and people are even telling me it > flat can't be done the way I want to do it (ie, simple and direct). if > that's true, asp.net is seriously flawed IMO. > > Randall > > "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message > news:1135898403.675888.324850@g44g2000cwa.googlegroups.com... > > Randall, > > i noticed you're using the PowerPoint object directly. another > > suggestion then might be to use the COM object's for office to build a > > word doc (or whatever format) on the server side, then send it to the > > client via the binary write sample from earlier. you can accomplish > > this using the Office PIAs (primary interop assemblies): > > > > > > http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en > > > > also, make sure you read through the known issues first so you avoid > > spinning your wheels: > > > > > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_piaissues.asp > > > > hope this helps, > > Mike MacMillan > > > > > > Randall Arnold wrote: > >> Wow! you sure went to a lot of effort there and I really appreciate it. > >> Just hope it works! > >> > >> What's extremely frustrating for me here is that one line of code is all > >> it > >> takes to get my chart object to the clipboard, to wit: > >> > >> Clipboard.SetImage(Chart1.GetChartBitmap) > >> > >> After that, a simple paste operation gets it into Powerpoint: > >> > >> objPres.Slides(1).Shapes.PasteSpecial(Microsoft.Office.Interop.PowerPoint.PpPasteDataType.ppPasteBitmap, > >> Microsoft.Office.Core.MsoTriState.msoFalse) > >> > >> That was all I was looking for, but darned if I could make the quivalent > >> method (SetDataObject) work for an html table. I'm still blown away by > >> the > >> fact that Microsoft made this so difficult! But maybe I shouldn't be by > >> now. > >> > >> Anyway, I'll give your suggestion a shot! Thanks again. > >> > >> Randall > >> > >> > >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message > >> news:1135888227.325139.217280@g49g2000cwa.googlegroups.com... > >> > Randall, > >> > ive included a simple page that binary writes the rendered html of a > >> > table to the client using the contentType application/msword. > >> > obviously, this is the most basic example, but should be enough to get > >> > you going. let me know if you have any questions. > >> > > >> > <%@ page language="c#" inherits="System.Web.UI.Page" > >> > autoEventWireup="true" %> > >> > <%@ import namespace="System.IO" %> > >> > <%@ import namespace="System.Text" %> > >> > <%@ import namespace="System.Web.UI" %> > >> > > >> > <script runat="server"> > >> > void OnExportData(object sender, EventArgs e) { > >> > StringWriter sw; > >> > HtmlTextWriter html; > >> > byte[] arStuff; > >> > > >> > //** create our output stream and htmltextwriter > >> > sw = new StringWriter(); > >> > html = new HtmlTextWriter(sw); > >> > > >> > //** get the table's rendered content > >> > tblStuff.RenderControl(html); > >> > sw.Flush(); > >> > > >> > //** get the byte array of the html output > >> > arStuff = Encoding.ASCII.GetBytes(sw.ToString()); > >> > > >> > //** set the contentType and binary write to the client > >> > Response.Clear(); > >> > Response.ContentType = "application/msword"; > >> > Response.AddHeader("Content-Disposition", "inline"); > >> > Response.AddHeader("Content-Length", ""+ arStuff.Length); > >> > Response.BinaryWrite(arStuff); > >> > Response.End(); > >> > } > >> > </script> > >> > > >> > <html> > >> > <head> > >> > <style type="text/css"> > >> > tr.columnHeaders td { background-color: #eee; font-weight: bold; } > >> > </style> > >> > </head> > >> > <body> > >> > <form runat="server"> > >> > > >> > <table border="0" width="100%" cellpadding="2" cellspacing="0" > >> > id="tblStuff" runat="server"> > >> > <tr class="columnHeaders"> > >> > <td>Column 1</td> > >> > <td>Column 2</td> > >> > <td>Column 3</td> > >> > <td>Column 4</td> > >> > </tr> > >> > > >> > <tr> > >> > <td>test data 01</td> > >> > <td>test data 02</td> > >> > <td>test data 03</td> > >> > <td>test data 04</td> > >> > </tr> > >> > > >> > <tr> > >> > <td>test data 11</td> > >> > <td>test data 12</td> > >> > <td>test data 13</td> > >> > <td>test data 14</td> > >> > </tr> > >> > > >> > <tr> > >> > <td>test data 21</td> > >> > <td>test data 22</td> > >> > <td>test data 23</td> > >> > <td>test data 24</td> > >> > </tr> > >> > > >> > <tr> > >> > <td>test data 31</td> > >> > <td>test data 32</td> > >> > <td>test data 33</td> > >> > <td>test data 34</td> > >> > </tr> > >> > </table> > >> > > >> > <asp:Button id="btnExport" text="Export Data" onclick="OnExportData" > >> > runat="server"/> > >> > > >> > </form> > >> > </body> > >> > </html> > >> > > >> > > >> > > >> > hope this helps, > >> > Mike MacMillan > >> > > >> > > >> > Randall Arnold wrote: > >> >> Mike: > >> >> > >> >> Your solution looks more like what I want to do than any other I've > >> >> come > >> >> across, thought of or been told to try. Unfortunately, I lack > >> >> experience > >> >> in > >> >> this area (binary writes). However, I'll certainly research it > >> >> because > >> >> everything else has failed miserably and I've almost given up getting > >> >> this > >> >> to work. > >> >> > >> >> All I really want is an asp.net web application that presents tables > >> >> and > >> >> charts of quality reports, and allow users to publish them in formats > >> >> with > >> >> which they are accustomed (Word, Powerpoint, et al). I never in my > >> >> wildest > >> >> dreams imagined it'd be as difficult an effort as it has turned out to > >> >> be. > >> >> I hope I can make your suggestion work. Thanks, > >> >> > >> >> Randall > >> >> > >> >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message > >> >> news:1135883389.449325.248080@g49g2000cwa.googlegroups.com... > >> >> > Randall, > >> >> > if the functionality you require is for someone to copy-and-paste a > >> >> > table from the website to word, this should be inherently supported > >> >> > with IE. my recommendation though would be to binary write the html > >> >> > for the table to the client, but change the ContentType to > >> >> > application/vnd-msword or application/vnd-msexcel. ive found by > >> >> > binary > >> >> > writing directly to these applications and letting the os handle > >> >> > which > >> >> > program to open (hopefully word and excel), the html comes out just > >> >> > fine, without the need to save files or use the windows clipboard. > >> >> > > >> >> > let me know if this helps, > >> >> > Mike MacMillan > >> >> > > >> >> > > >> >> > Randall Arnold wrote: > >> >> >> I'm about to give up on what I thought would be a simple effort but > >> >> >> figured > >> >> >> I'd give it one more try here. > >> >> >> > >> >> >> I want to programmatically select an html table rendered on an aspx > >> >> >> page > >> >> >> (using VB) and copy it to another application (Word, Powerpoint, > >> >> >> Excel, > >> >> >> et > >> >> >> al)... probably using the Windows clipboard. > >> >> >> > >> >> >> So far I have a really crude method that involves saving the table > >> >> >> as > >> >> >> an > >> >> >> html file, reloading it in Word, copying table to clipboard, etc > >> >> >> etc > >> >> >> etc-- > >> >> >> but *surely* there has to be a more elegant method, ie, accessing > >> >> >> the > >> >> >> table > >> >> >> as an object right off the web page and copying it from there. > >> >> >> Problem > >> >> >> is, > >> >> >> I can't find a single example of how to do this and the few > >> >> >> suggestions > >> >> >> I've > >> >> >> received aren't helpful. > >> >> >> > >> >> >> So one last gasp: anyone here have any ideas? > >> >> >> > >> >> >> Thanks, > >> >> >> > >> >> >> Randall Arnold > >> >> > > >> > > > This might all be moot if I could place Microsoft Office Web Components on
an asp.net page as I was led to believe was possible. The components aren't available to Visual Web Developer Express, however, for reasons no one has been able to explain to me. What a fiasco. I just want to copy a simple table to another app. I never in my wildest dreams imagines this task would turn out to be such a nightmare. : ( Randall ArnoldShow quoteHide quote "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message news:1135900434.412106.194700@g47g2000cwa.googlegroups.com... > Randall, >> I had originally envisioned using >> the interops, but just can't figure out how they can help me get the >> table >> object from the asp.net page and into the target application > > keep in mind that any office docs u create/manipulate with the pia's > are on the server side, not the client side. you're still bound by the > limitations of http for sending data to the client. a solution for > sending a single table might be to use the pia's to create a word doc, > save it to a temp folder on the server, then send it to the client. > this will allow you more direct control over what is built, rather then > hoping word renders your html correctly. > > Mike MacMillan > > > Randall Arnold wrote: >> Thanks again. Your earlier method worked, although with some >> limitations. >> I'll check the links you provided later. I had originally envisioned >> using >> the interops, but just can't figure out how they can help me get the >> table >> object from the asp.net page and into the target application. There's a >> serious lack of info out there on this, and people are even telling me it >> flat can't be done the way I want to do it (ie, simple and direct). if >> that's true, asp.net is seriously flawed IMO. >> >> Randall >> >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message >> news:1135898403.675888.324850@g44g2000cwa.googlegroups.com... >> > Randall, >> > i noticed you're using the PowerPoint object directly. another >> > suggestion then might be to use the COM object's for office to build a >> > word doc (or whatever format) on the server side, then send it to the >> > client via the binary write sample from earlier. you can accomplish >> > this using the Office PIAs (primary interop assemblies): >> > >> > >> > http://www.microsoft.com/downloads/details.aspx?FamilyId=C41BD61E-3060-4F71-A6B4-01FEBA508E52&displaylang=en >> > >> > also, make sure you read through the known issues first so you avoid >> > spinning your wheels: >> > >> > >> > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_piaissues.asp >> > >> > hope this helps, >> > Mike MacMillan >> > >> > >> > Randall Arnold wrote: >> >> Wow! you sure went to a lot of effort there and I really appreciate >> >> it. >> >> Just hope it works! >> >> >> >> What's extremely frustrating for me here is that one line of code is >> >> all >> >> it >> >> takes to get my chart object to the clipboard, to wit: >> >> >> >> Clipboard.SetImage(Chart1.GetChartBitmap) >> >> >> >> After that, a simple paste operation gets it into Powerpoint: >> >> >> >> objPres.Slides(1).Shapes.PasteSpecial(Microsoft.Office.Interop.PowerPoint.PpPasteDataType.ppPasteBitmap, >> >> Microsoft.Office.Core.MsoTriState.msoFalse) >> >> >> >> That was all I was looking for, but darned if I could make the >> >> quivalent >> >> method (SetDataObject) work for an html table. I'm still blown away >> >> by >> >> the >> >> fact that Microsoft made this so difficult! But maybe I shouldn't be >> >> by >> >> now. >> >> >> >> Anyway, I'll give your suggestion a shot! Thanks again. >> >> >> >> Randall >> >> >> >> >> >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message >> >> news:1135888227.325139.217280@g49g2000cwa.googlegroups.com... >> >> > Randall, >> >> > ive included a simple page that binary writes the rendered html of >> >> > a >> >> > table to the client using the contentType application/msword. >> >> > obviously, this is the most basic example, but should be enough to >> >> > get >> >> > you going. let me know if you have any questions. >> >> > >> >> > <%@ page language="c#" inherits="System.Web.UI.Page" >> >> > autoEventWireup="true" %> >> >> > <%@ import namespace="System.IO" %> >> >> > <%@ import namespace="System.Text" %> >> >> > <%@ import namespace="System.Web.UI" %> >> >> > >> >> > <script runat="server"> >> >> > void OnExportData(object sender, EventArgs e) { >> >> > StringWriter sw; >> >> > HtmlTextWriter html; >> >> > byte[] arStuff; >> >> > >> >> > //** create our output stream and htmltextwriter >> >> > sw = new StringWriter(); >> >> > html = new HtmlTextWriter(sw); >> >> > >> >> > //** get the table's rendered content >> >> > tblStuff.RenderControl(html); >> >> > sw.Flush(); >> >> > >> >> > //** get the byte array of the html output >> >> > arStuff = Encoding.ASCII.GetBytes(sw.ToString()); >> >> > >> >> > //** set the contentType and binary write to the client >> >> > Response.Clear(); >> >> > Response.ContentType = "application/msword"; >> >> > Response.AddHeader("Content-Disposition", "inline"); >> >> > Response.AddHeader("Content-Length", ""+ arStuff.Length); >> >> > Response.BinaryWrite(arStuff); >> >> > Response.End(); >> >> > } >> >> > </script> >> >> > >> >> > <html> >> >> > <head> >> >> > <style type="text/css"> >> >> > tr.columnHeaders td { background-color: #eee; font-weight: >> >> > bold; } >> >> > </style> >> >> > </head> >> >> > <body> >> >> > <form runat="server"> >> >> > >> >> > <table border="0" width="100%" cellpadding="2" cellspacing="0" >> >> > id="tblStuff" runat="server"> >> >> > <tr class="columnHeaders"> >> >> > <td>Column 1</td> >> >> > <td>Column 2</td> >> >> > <td>Column 3</td> >> >> > <td>Column 4</td> >> >> > </tr> >> >> > >> >> > <tr> >> >> > <td>test data 01</td> >> >> > <td>test data 02</td> >> >> > <td>test data 03</td> >> >> > <td>test data 04</td> >> >> > </tr> >> >> > >> >> > <tr> >> >> > <td>test data 11</td> >> >> > <td>test data 12</td> >> >> > <td>test data 13</td> >> >> > <td>test data 14</td> >> >> > </tr> >> >> > >> >> > <tr> >> >> > <td>test data 21</td> >> >> > <td>test data 22</td> >> >> > <td>test data 23</td> >> >> > <td>test data 24</td> >> >> > </tr> >> >> > >> >> > <tr> >> >> > <td>test data 31</td> >> >> > <td>test data 32</td> >> >> > <td>test data 33</td> >> >> > <td>test data 34</td> >> >> > </tr> >> >> > </table> >> >> > >> >> > <asp:Button id="btnExport" text="Export Data" onclick="OnExportData" >> >> > runat="server"/> >> >> > >> >> > </form> >> >> > </body> >> >> > </html> >> >> > >> >> > >> >> > >> >> > hope this helps, >> >> > Mike MacMillan >> >> > >> >> > >> >> > Randall Arnold wrote: >> >> >> Mike: >> >> >> >> >> >> Your solution looks more like what I want to do than any other I've >> >> >> come >> >> >> across, thought of or been told to try. Unfortunately, I lack >> >> >> experience >> >> >> in >> >> >> this area (binary writes). However, I'll certainly research it >> >> >> because >> >> >> everything else has failed miserably and I've almost given up >> >> >> getting >> >> >> this >> >> >> to work. >> >> >> >> >> >> All I really want is an asp.net web application that presents >> >> >> tables >> >> >> and >> >> >> charts of quality reports, and allow users to publish them in >> >> >> formats >> >> >> with >> >> >> which they are accustomed (Word, Powerpoint, et al). I never in my >> >> >> wildest >> >> >> dreams imagined it'd be as difficult an effort as it has turned out >> >> >> to >> >> >> be. >> >> >> I hope I can make your suggestion work. Thanks, >> >> >> >> >> >> Randall >> >> >> >> >> >> "Mike MacMillan" <mikejmacmil***@gmail.com> wrote in message >> >> >> news:1135883389.449325.248080@g49g2000cwa.googlegroups.com... >> >> >> > Randall, >> >> >> > if the functionality you require is for someone to >> >> >> > copy-and-paste a >> >> >> > table from the website to word, this should be inherently >> >> >> > supported >> >> >> > with IE. my recommendation though would be to binary write the >> >> >> > html >> >> >> > for the table to the client, but change the ContentType to >> >> >> > application/vnd-msword or application/vnd-msexcel. ive found by >> >> >> > binary >> >> >> > writing directly to these applications and letting the os handle >> >> >> > which >> >> >> > program to open (hopefully word and excel), the html comes out >> >> >> > just >> >> >> > fine, without the need to save files or use the windows >> >> >> > clipboard. >> >> >> > >> >> >> > let me know if this helps, >> >> >> > Mike MacMillan >> >> >> > >> >> >> > >> >> >> > Randall Arnold wrote: >> >> >> >> I'm about to give up on what I thought would be a simple effort >> >> >> >> but >> >> >> >> figured >> >> >> >> I'd give it one more try here. >> >> >> >> >> >> >> >> I want to programmatically select an html table rendered on an >> >> >> >> aspx >> >> >> >> page >> >> >> >> (using VB) and copy it to another application (Word, Powerpoint, >> >> >> >> Excel, >> >> >> >> et >> >> >> >> al)... probably using the Windows clipboard. >> >> >> >> >> >> >> >> So far I have a really crude method that involves saving the >> >> >> >> table >> >> >> >> as >> >> >> >> an >> >> >> >> html file, reloading it in Word, copying table to clipboard, etc >> >> >> >> etc >> >> >> >> etc-- >> >> >> >> but *surely* there has to be a more elegant method, ie, >> >> >> >> accessing >> >> >> >> the >> >> >> >> table >> >> >> >> as an object right off the web page and copying it from there. >> >> >> >> Problem >> >> >> >> is, >> >> >> >> I can't find a single example of how to do this and the few >> >> >> >> suggestions >> >> >> >> I've >> >> >> >> received aren't helpful. >> >> >> >> >> >> >> >> So one last gasp: anyone here have any ideas? >> >> >> >> >> >> >> >> Thanks, >> >> >> >> >> >> >> >> Randall Arnold >> >> >> > >> >> > >> > >
What functionality does Infragistics controls offer, which don't come with VS .NET 2005?
Master Pages and Cross-Page Form Information grid postback Closing window/page Datagrid Listbox is overlapping the Textbox in Asp.net Basic formatting for HTML text in ASP.NET 1.1 ? Adding a Directive to a dynamically created Template Column on gri Hi Is there a way to set onmouseover for a LinkButton in ASP.NET 2.0 ? |
|||||||||||||||||||||||