OWC Spreadsheet

B

Brian Hman

We have an OWC pivot table that we use to display data from a backend
data source. We use a data handler to send this pivot table data. Now we'd
like to use an OWC spreadsheet to display data--especially html links, and I
can't seem to find the right example to do this.

Here's the pivot table code that we are currently using:
<script language="JScript">
function btnSubmit_OnClick()
{

var strQuery =
"http://igor/_layouts/DataTransform/SasResponder.ashxsasQuery=" +
document.Form1.sasQuery.value;
var strConnectionString = "Provider=MSPERSIST";

//Create a new ADODB.Recordset object for retrieving the XML data from the
server.
var objRecordset = new ActiveXObject('ADODB.Recordset');
//Open the Recordset by pointing to the URL for the ASP.NET Handler
//...that returns our XML data

try
{
objRecordset.Open(strQuery, strConnectionString);
if (!objRecordset.EOF)
{
document.pt.DataSource = objRecordset;
//Automatically displays all columns on the pivottable
document.pt.ActiveView.AutoLayout();
document.pt.ActiveView.UseProviderFormatting = false;
document.pt.Height=500;
document.pt.Width=1500;
}
}
catch(e)
{
document.pt.write("No Data Returned");
}
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<h2>Call Data</h2>
<form id="Form1" method="post" runat="server">
<TEXTAREA id="Query" style="Z-INDEX: 101; LEFT: 5px; WIDTH:
600px; POSITION: absolute; TOP: 0px;
HEIGHT: 300px"
rows="2" cols="46">
select state,sbmtdt,rsbmtdt,dupdate,insdate,traknum from
iba_adh.colo1104 where state='CO'
</TEXTAREA>
<INPUT id="btnSubmit" style="Z-INDEX: 103; LEFT: 584px; WIDTH:
96px; POSITION: absolute; TOP: 0px; HEIGHT: 24px"
onclick="javascript:btnSubmit_OnClick();" type="button"
value="SubmitQuery">

<OBJECT class="ptexec" id="pt" style="Z-INDEX: 107; LEFT:
184px;
WIDTH: 502px; POSITION: absolute; TOP: 350px; HEIGHT: 217px"
height="217" width="502"
classid="clsid:0002E55A-0000-0000-C000-000000000046"
VIEWASTEXT>
<PARAM NAME="XMLData" VALUE='<xml xmlns:x="urn:schemas-
microsoft-com:eek:ffice:excel">
<x:pivotTable>

<x:OWCVersion>11.0.0.5531 </x:OWCVersion>

<x:DisplayScreenTips/>

<x:CubeProvider>msolap.2</x:CubeProvider>

<x:CacheDetails/>
<x:pivotView>

<x:IsNotFiltered/>
</x:pivotView>

</x:pivotTable>
</xml>'>
</OBJECT>
</form>
</body>

I would like to find an example of the Spreadsheet component that does the
same thing. I tried to use the Pivot Table example shown above to help me
with the Spreadsheet, but it doesn't return data to the Spreadsheet. I
stepped through the client side code within the debugger and the code to get
the data is executing.

Here's what I tried to do:
<script language="JScript">
function btnSubmit_OnClick()
{

var strQuery =
"http://igor/_layouts/DataTransform/SasResponder.ashxsasQuery=" +
document.Form1.sasQuery.value;
var strConnectionString = "Provider=MSPERSIST";

//Create a new ADODB.Recordset object for retrieving the XML data from the
server.
var objRecordset = new ActiveXObject('ADODB.Recordset');

//Open the Recordset by pointing to the URL for the ASP.NET Handler
//...that returns our XML data

try
{
objRecordset.Open(strQuery, strConnectionString);
if (!objRecordset.EOF)
{
document.pt.DataSource = objRecordset;
document.pt.Height=500;
document.pt.Width=1500;
}
}
catch(e)
{
//document.pt.write("No Data Returned");
}
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<h2>Call Sas Data</h2>
<form id="Form1" method="post" runat="server">
<TEXTAREA id="sasQuery" style="Z-INDEX: 101; LEFT: 5px; WIDTH: 600px;
POSITION: absolute; TOP: 0px; HEIGHT: 300px"
rows="2" cols="46">
select state,sbmtdt,rsbmtdt,dupdate,insdate,traknum from
iba_adh.colo1104 where state='CO'

</TEXTAREA>
<INPUT id="btnSubmit" style="Z-INDEX: 103; LEFT: 584px; WIDTH: 96px;
POSITION: absolute; TOP: 0px; HEIGHT: 24px"
onclick="javascript:btnSubmit_OnClick();"
type="button" value="Submit Query">
<OBJECT class="phooey"
id="pt"
style="Z-INDEX: 107; LEFT: 184px; WIDTH: 502px; POSITION:
absolute;
TOP: 350px; HEIGHT: 217px"
classid="CLSID:0002E559-0000-0000-C000-000000000046" VIEWASTEXT>
<PARAM NAME="DataType" VALUE="XMLDATA">
</OBJECT>
</form>
</body>

I don't think I have the correct parameters set. Any hints or urls are
greatly appreciated.

Brian Hman
 
W

Wei-Dong XU [MSFT]

Hi Brian,

As I know, you will need to assing the value into each cell
programmatically. And then specify the formulat for these cells whose value
will be hyper link. For example:
Set rngRandomNum = Spreadsheet1.Worksheets("Sheet1").Range("B5")
' Insert a formula into cell B5.
rngRandomNum.Formula =
"=HYPERLINK(""http://example.microsoft.com/report/budget report.xls"",
""<SPECIFY THE VALUE HERE>"")"

Please feel free to let me know if you have any question.

Best Regards,
Wei-Dong XU
Microsoft Product Support Services
This posting is provided "AS IS" with no warranties, and confers no rights.
 
B

Brian Hman

Wei-Dong XU,

Thanks for your reply. Do you have any examples where the URL resides in an
ADO recordset? That's how I'm trying to populate the spreadsheet component.

Thanks,
Brian
 
W

Wei-Dong XU [MSFT]

Hi Brian,

The Type property of ADO Field object doesn't have the enumeration member:
hyperlink. So I think we will have to add specific code to handle the URL
column. This is to say, if the column 3 (Personal site) of your data
source table contains the hyper link, we can write extra code to handle
this.

Please feel free to let me know if you have any question. It is my pleasure
to be of any assistance.

Best Regards,
Wei-Dong XU
Microsoft Product Support Services
This posting is provided "AS IS" with no warranties, and confers no rights.
 

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