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
What a fiasco. I just want to copy a simple table to another app. I never
"Mike MacMillan" <mikejmacmillan@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" <mikejmacmillan@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" <mikejmacmillan@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,