Hi, thanks for the response. I will give it a try.
"Martin Honnen" wrote:
> Paul wrote:
> > Also under the Workbook I have the following
> > xmlns:ss = urn:schemas-microsoft-com:office:spreadsheet
>
> Here is some sample code that should help, you merely need to use the
> WriteStartElement, WriteElementString and WriteAttributeString overloads
> that allow you to specify prefix, local name, namespace and value:
>
> const string spreadsheetNamespace =
> "urn:schemas-microsoft-com:office:spreadsheet";
> const string officeNamespace =
> "urn:schemas-microsoft-com:office:office";
> const string excelNamespace =
> "urn:schemas-microsoft-com:office:excel";
> const string htmlNamespace = "
http://www.w3.org/TR/REC-html40"; >
> XmlWriterSettings writerSettings = new XmlWriterSettings();
> writerSettings.Indent = true;
> using (XmlWriter xmlWriter = XmlWriter.Create("file.xml",
> writerSettings))
> {
> xmlWriter.WriteStartElement("Row", spreadsheetNamespace);
> xmlWriter.WriteStartElement("Cell", spreadsheetNamespace);
> xmlWriter.WriteAttributeString("ss", "StyleID",
> spreadsheetNamespace, "s87");
> xmlWriter.WriteStartElement("ss", "Data",
> spreadsheetNamespace);
> xmlWriter.WriteAttributeString("ss", "Type",
> spreadsheetNamespace, "String");
> xmlWriter.WriteAttributeString(null, "xmlns", null,
> htmlNamespace);
> xmlWriter.WriteStartElement("Font", htmlNamespace);
> xmlWriter.WriteAttributeString("html", "Color",
> htmlNamespace, "#FF0000");
> xmlWriter.WriteString("M90");
> xmlWriter.WriteEndElement();
> xmlWriter.WriteElementString("Font", htmlNamespace,
> "/Thu");
> xmlWriter.WriteEndElement();
> xmlWriter.WriteEndElement();
> xmlWriter.WriteEndElement();
> }
>
> Result is
>
> <Row xmlns="urn:schemas-microsoft-com:office:spreadsheet">
> <Cell ss:StyleID="s87"
> xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
> <ss:Data ss:Type="String" xmlns="
http://www.w3.org/TR/REC-html40"> > <Font html:Color="#FF0000"
> xmlns:html="
http://www.w3.org/TR/REC-html40">M90</Font>
> <Font>/Thu</Font>
> </ss:Data>
> </Cell>
> </Row>
>
> --
>
> Martin Honnen --- MVP XML
>
http://JavaScript.FAQTs.com/