A
Alvin T
I am implementing the OWC11 Spreadsheet component as a server side
calculation engine, for a .NET webservice.
When I export an Excel Workbook with XML Maps and attempt to load it
into the OWC Spreadsheet by setting the Workbook.URLXML property, I get
an "Unspecified Error". However, when I delete the XML Maps out of the
Workbook and subsequently import the XML, I get no error. What am I
missing?
I need to maintain the xmlMaps because that is how my web service
passes arguments to the calculation engine.
The other strange thing is if i load the same xml Workbook that cause
the server side error, on a client side OWC Spreadsheet, I don't get
any errors.
Here is a snippet of my Wrapper Class:
public class ExcelWrapper
{
// Instantiate the SpreadSheet Component
private SpreadsheetClass ss = new SpreadsheetClass();
public ExcelWrapper()
{
try
{
//Load the Calculation template
//ss.XMLURL =
"C:\\Inetpub\\wwwroot\\ExcelService2\\wb\\LoanCalcNoMaps.xml";
ss.XMLURL =
"C:\\Inetpub\\wwwroot\\ExcelService2\\wb\\LoanCalc.xml";
}
catch(Exception e)
{
HttpContext.Current.Response.Write(e.Message);
}
}
===================================================================
The following is my XML Spreadsheet with the Maps:
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-comffice:spreadsheet"
xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:x="urn:schemas-microsoft-comffice:excel"
xmlns:ss="urn:schemas-microsoft-comffice:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml">
<DocumentProperties xmlns="urn:schemas-microsoft-comfficeffice">
<LastAuthor>None of your business</LastAuthor>
<Created>1996-10-14T23:33:28Z</Created>
<LastSaved>2005-03-12T22:03:01Z</LastSaved>
<Version>11.6360</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-comffice:excel">
<WindowHeight>9300</WindowHeight>
<WindowWidth>15135</WindowWidth>
<WindowTopX>120</WindowTopX>
<WindowTopY>120</WindowTopY>
<AcceptLabelsInFormulas/>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
<FutureVer>11</FutureVer>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s21">
<NumberFormat ss:Format="@"/>
</Style>
<Style ss:ID="s22">
<NumberFormat ss:Format=""$"#,##0.00"/>
</Style>
<Style ss:ID="s23">
<NumberFormat ss:Format="Percent"/>
</Style>
<Style ss:ID="s24">
<NumberFormat ss:Format="Fixed"/>
</Style>
</Styles>
<Names>
<NamedRange ss:Name="principal" ss:RefersTo="=Sheet1!R2C2"/>
<NamedRange ss:Name="rate" ss:RefersTo="=Sheet1!R3C2"/>
<NamedRange ss:Name="version" ss:RefersTo="=Sheet1!R1C1"/>
<NamedRange ss:Name="years" ss:RefersTo="=Sheet1!R4C2"/>
</Names>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="5"
x:FullColumns="1"
x:FullRows="1">
<Column ss:AutoFitWidth="0" ss:Width="113.25"/>
<Row>
<Cell ss:StyleID="s21"><Data ss:Type="String">Simple Interest Loan
1.0</Data><NamedCell
ss:Name="version"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Principal</Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="Number">1000</Data><NamedCell
ss:Name="principal"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Rate</Data></Cell>
<Cell ss:StyleID="s23"><Data ss:Type="Number">0.07</Data><NamedCell
ss:Name="rate"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Years</Data></Cell>
<Cell ss:StyleID="s24"><Data ss:Type="Number">10</Data><NamedCell
ss:Name="years"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Loan With Interest</Data></Cell>
<Cell ss:StyleID="s22" ss:Formula="=(principal*rate*years) +
principal"><Data
ss:Type="Number">1700</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-comffice:excel">
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>4</ActiveRow>
<ActiveCol>1</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet2">
<WorksheetOptions xmlns="urn:schemas-microsoft-comffice:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet3">
<WorksheetOptions xmlns="urn:schemas-microsoft-comffice:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<x2:MapInfo x2:HideInactiveListBorder="false">
<x2:Schema x2:ID="Schema2" x2:Namespace=""><xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:element
nillable="true" name="data"><xsd:complexType><xsd:sequence
minOccurs="0"><xsd:element minOccurs="0" nillable="true"
type="xsd:string" name="version"
form="unqualified"></xsd:element><xsd:element minOccurs="0"
nillable="true" name="terms"
form="unqualified"><xsd:complexType><xsd:sequence
minOccurs="0"><xsd:element minOccurs="0" nillable="true"
type="xsd:integer" name="principal"
form="unqualified"></xsd:element><xsd:element minOccurs="0"
nillable="true" type="xsd:double" name="rate"
form="unqualified"></xsd:element><xsd:element minOccurs="0"
nillable="true" type="xsd:integer" name="years"
form="unqualified"></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:schema>
</x2:Schema>
<x2:Schema x2:ID="Schema3" x2:Namespace=""><xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:element
nillable="true" name="data"><xsd:complexType><xsd:sequence
minOccurs="0"><xsd:element minOccurs="0" nillable="true"
type="xsd:string" name="loan"
form="unqualified"></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:schema>
</x2:Schema>
<x2:Map x2:ID="Export" x2:SchemaID="Schema3" x2:RootElement="data">
<x2:Entry x2:Type="single" x2:ID="5">
<x2:Range>Sheet1!R5C2</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/loan</x2:XPath>
<x2:Field>
<x2:XSDType>string</x2:XSDType>
<ss:Cell ss:Formula="=(principal*rate*years) + principal">
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
</x2:Map>
<x2:Map x2:ID="Import" x2:SchemaID="Schema2" x2:RootElement="data">
<x2:Entry x2:Type="single" x2:ID="1">
<x2:Range>Sheet1!R1C1</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/version</x2:XPath>
<x2:Field>
<x2:XSDType>string</x2:XSDType>
<ss:Cell>
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
<x2:Entry x2:Type="single" x2:ID="2">
<x2:Range>Sheet1!R2C2</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/terms/principal</x2:XPath>
<x2:Field>
<x2:XSDType>integer</x2:XSDType>
<ss:Cell>
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
<x2:Entry x2:Type="single" x2:ID="3">
<x2:Range>Sheet1!R3C2</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/terms/rate</x2:XPath>
<x2:Field>
<x2:XSDType>double</x2:XSDType>
<ss:Cell>
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
<x2:Entry x2:Type="single" x2:ID="4">
<x2:Range>Sheet1!R4C2</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/terms/years</x2:XPath>
<x2:Field>
<x2:XSDType>integer</x2:XSDType>
<ss:Cell>
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
</x2:Map>
</x2:MapInfo>
<x2:Binding x2:ID="Binding1" x2:LoadMode="normal">
<x2:MapID>Export</x2:MapID>
<udcataSource MajorVersion="1" MinorVersion="0"
xmlns:udc="http://schemas.microsoft.com/data/udc">
<udc:Type Type="XMLFile" MajorVersion="1" MinorVersion="0"/>
<udc:Name>Binding1</udc:Name>
<udc:ConnectionInfo Purpose="Query">
<udcxf:File
xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile">C:\Inetpub\wwwroot\ExcelService2\wb\LoanCalcExport.xml</udcxf:File>
</udc:ConnectionInfo>
</udcataSource>
</x2:Binding>
<x2:Binding x2:ID="Binding2" x2:LoadMode="normal">
<x2:MapID>Import</x2:MapID>
<udcataSource MajorVersion="1" MinorVersion="0"
xmlns:udc="http://schemas.microsoft.com/data/udc">
<udc:Type Type="XMLFile" MajorVersion="1" MinorVersion="0"/>
<udc:Name>Binding2</udc:Name>
<udc:ConnectionInfo Purpose="Query">
<udcxf:File
xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile">C:\Inetpub\wwwroot\ExcelService2\wb\LoanCalcData.xml</udcxf:File>
</udc:ConnectionInfo>
</udcataSource>
</x2:Binding>
</Workbook>
===================================================================
BTW: Alvin Bruney (Great first name) I hope your book arrives soon, I
need the help.
Alvin T
calculation engine, for a .NET webservice.
When I export an Excel Workbook with XML Maps and attempt to load it
into the OWC Spreadsheet by setting the Workbook.URLXML property, I get
an "Unspecified Error". However, when I delete the XML Maps out of the
Workbook and subsequently import the XML, I get no error. What am I
missing?
I need to maintain the xmlMaps because that is how my web service
passes arguments to the calculation engine.
The other strange thing is if i load the same xml Workbook that cause
the server side error, on a client side OWC Spreadsheet, I don't get
any errors.
Here is a snippet of my Wrapper Class:
public class ExcelWrapper
{
// Instantiate the SpreadSheet Component
private SpreadsheetClass ss = new SpreadsheetClass();
public ExcelWrapper()
{
try
{
//Load the Calculation template
//ss.XMLURL =
"C:\\Inetpub\\wwwroot\\ExcelService2\\wb\\LoanCalcNoMaps.xml";
ss.XMLURL =
"C:\\Inetpub\\wwwroot\\ExcelService2\\wb\\LoanCalc.xml";
}
catch(Exception e)
{
HttpContext.Current.Response.Write(e.Message);
}
}
===================================================================
The following is my XML Spreadsheet with the Maps:
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-comffice:spreadsheet"
xmlns="urn:schemas-microsoft-comfficeffice"
xmlns:x="urn:schemas-microsoft-comffice:excel"
xmlns:ss="urn:schemas-microsoft-comffice:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml">
<DocumentProperties xmlns="urn:schemas-microsoft-comfficeffice">
<LastAuthor>None of your business</LastAuthor>
<Created>1996-10-14T23:33:28Z</Created>
<LastSaved>2005-03-12T22:03:01Z</LastSaved>
<Version>11.6360</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-comffice:excel">
<WindowHeight>9300</WindowHeight>
<WindowWidth>15135</WindowWidth>
<WindowTopX>120</WindowTopX>
<WindowTopY>120</WindowTopY>
<AcceptLabelsInFormulas/>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
<FutureVer>11</FutureVer>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s21">
<NumberFormat ss:Format="@"/>
</Style>
<Style ss:ID="s22">
<NumberFormat ss:Format=""$"#,##0.00"/>
</Style>
<Style ss:ID="s23">
<NumberFormat ss:Format="Percent"/>
</Style>
<Style ss:ID="s24">
<NumberFormat ss:Format="Fixed"/>
</Style>
</Styles>
<Names>
<NamedRange ss:Name="principal" ss:RefersTo="=Sheet1!R2C2"/>
<NamedRange ss:Name="rate" ss:RefersTo="=Sheet1!R3C2"/>
<NamedRange ss:Name="version" ss:RefersTo="=Sheet1!R1C1"/>
<NamedRange ss:Name="years" ss:RefersTo="=Sheet1!R4C2"/>
</Names>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="5"
x:FullColumns="1"
x:FullRows="1">
<Column ss:AutoFitWidth="0" ss:Width="113.25"/>
<Row>
<Cell ss:StyleID="s21"><Data ss:Type="String">Simple Interest Loan
1.0</Data><NamedCell
ss:Name="version"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Principal</Data></Cell>
<Cell ss:StyleID="s22"><Data ss:Type="Number">1000</Data><NamedCell
ss:Name="principal"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Rate</Data></Cell>
<Cell ss:StyleID="s23"><Data ss:Type="Number">0.07</Data><NamedCell
ss:Name="rate"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Years</Data></Cell>
<Cell ss:StyleID="s24"><Data ss:Type="Number">10</Data><NamedCell
ss:Name="years"/></Cell>
</Row>
<Row>
<Cell><Data ss:Type="String">Loan With Interest</Data></Cell>
<Cell ss:StyleID="s22" ss:Formula="=(principal*rate*years) +
principal"><Data
ss:Type="Number">1700</Data></Cell>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-comffice:excel">
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>4</ActiveRow>
<ActiveCol>1</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet2">
<WorksheetOptions xmlns="urn:schemas-microsoft-comffice:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<Worksheet ss:Name="Sheet3">
<WorksheetOptions xmlns="urn:schemas-microsoft-comffice:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
<x2:MapInfo x2:HideInactiveListBorder="false">
<x2:Schema x2:ID="Schema2" x2:Namespace=""><xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:element
nillable="true" name="data"><xsd:complexType><xsd:sequence
minOccurs="0"><xsd:element minOccurs="0" nillable="true"
type="xsd:string" name="version"
form="unqualified"></xsd:element><xsd:element minOccurs="0"
nillable="true" name="terms"
form="unqualified"><xsd:complexType><xsd:sequence
minOccurs="0"><xsd:element minOccurs="0" nillable="true"
type="xsd:integer" name="principal"
form="unqualified"></xsd:element><xsd:element minOccurs="0"
nillable="true" type="xsd:double" name="rate"
form="unqualified"></xsd:element><xsd:element minOccurs="0"
nillable="true" type="xsd:integer" name="years"
form="unqualified"></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:schema>
</x2:Schema>
<x2:Schema x2:ID="Schema3" x2:Namespace=""><xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><xsd:element
nillable="true" name="data"><xsd:complexType><xsd:sequence
minOccurs="0"><xsd:element minOccurs="0" nillable="true"
type="xsd:string" name="loan"
form="unqualified"></xsd:element></xsd:sequence></xsd:complexType></xsd:element></xsd:schema>
</x2:Schema>
<x2:Map x2:ID="Export" x2:SchemaID="Schema3" x2:RootElement="data">
<x2:Entry x2:Type="single" x2:ID="5">
<x2:Range>Sheet1!R5C2</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/loan</x2:XPath>
<x2:Field>
<x2:XSDType>string</x2:XSDType>
<ss:Cell ss:Formula="=(principal*rate*years) + principal">
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
</x2:Map>
<x2:Map x2:ID="Import" x2:SchemaID="Schema2" x2:RootElement="data">
<x2:Entry x2:Type="single" x2:ID="1">
<x2:Range>Sheet1!R1C1</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/version</x2:XPath>
<x2:Field>
<x2:XSDType>string</x2:XSDType>
<ss:Cell>
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
<x2:Entry x2:Type="single" x2:ID="2">
<x2:Range>Sheet1!R2C2</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/terms/principal</x2:XPath>
<x2:Field>
<x2:XSDType>integer</x2:XSDType>
<ss:Cell>
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
<x2:Entry x2:Type="single" x2:ID="3">
<x2:Range>Sheet1!R3C2</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/terms/rate</x2:XPath>
<x2:Field>
<x2:XSDType>double</x2:XSDType>
<ss:Cell>
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
<x2:Entry x2:Type="single" x2:ID="4">
<x2:Range>Sheet1!R4C2</x2:Range>
<x:FilterOn>False</x:FilterOn>
<x2:XPath>/data/terms/years</x2:XPath>
<x2:Field>
<x2:XSDType>integer</x2:XSDType>
<ss:Cell>
</ss:Cell>
<x2:Aggregate>None</x2:Aggregate>
</x2:Field>
</x2:Entry>
</x2:Map>
</x2:MapInfo>
<x2:Binding x2:ID="Binding1" x2:LoadMode="normal">
<x2:MapID>Export</x2:MapID>
<udcataSource MajorVersion="1" MinorVersion="0"
xmlns:udc="http://schemas.microsoft.com/data/udc">
<udc:Type Type="XMLFile" MajorVersion="1" MinorVersion="0"/>
<udc:Name>Binding1</udc:Name>
<udc:ConnectionInfo Purpose="Query">
<udcxf:File
xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile">C:\Inetpub\wwwroot\ExcelService2\wb\LoanCalcExport.xml</udcxf:File>
</udc:ConnectionInfo>
</udcataSource>
</x2:Binding>
<x2:Binding x2:ID="Binding2" x2:LoadMode="normal">
<x2:MapID>Import</x2:MapID>
<udcataSource MajorVersion="1" MinorVersion="0"
xmlns:udc="http://schemas.microsoft.com/data/udc">
<udc:Type Type="XMLFile" MajorVersion="1" MinorVersion="0"/>
<udc:Name>Binding2</udc:Name>
<udc:ConnectionInfo Purpose="Query">
<udcxf:File
xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile">C:\Inetpub\wwwroot\ExcelService2\wb\LoanCalcData.xml</udcxf:File>
</udc:ConnectionInfo>
</udcataSource>
</x2:Binding>
</Workbook>
===================================================================
BTW: Alvin Bruney (Great first name) I hope your book arrives soon, I
need the help.
Alvin T