PC Review


Reply
Thread Tools Rate Thread

dataset to rtf

 
 
=?Utf-8?B?Y2hyaXM=?=
Guest
Posts: n/a
 
      17th Mar 2005
Hi,
I convert a dataSet to rtf with this code:

ds = createDataSet();
XmlDataDocument xmlDoc2 = new XmlDataDocument(ds);
XslTransform xslTran = new XslTransform();
xslTran.Load(Server.MapPath("rtf.xslt"));
Response.ContentType = "application/msword";
Response.Charset = "";
Response.ContentEncoding = System.Text.Encoding.Default;
Response.AddHeader("Content-Disposition", "inline;filename="+strTmp+".rtf");
xslTran.Transform(xmlDoc2, null, Response.Output, null);

The stylesheet looks like this:

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl=
"http://www.w3.org/1999/XSL/Transform">
<xslutput method="text"/>
<xsl:template match="/">
<xsl:text>{\rtf1 \f4\fs18</xsl:text
<xsl:text>{\colortbl;\red255\green255\blue255;\red0\green0\blue255;}</xsl:text>
<xsl:for-each select="NewDataSet/tblUserData">
<xsl:text>\b </xsl:text>
<xsl:value-of select="User_Name"/>
<xsl:text>\b0 </xsl:text>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Position"/>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Department" />
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Phone"/>
<xsl:text>\par </xsl:text>
<xsl:value-of select="User_Fax"/>
</xsl:for-each>

<xsl:text>}</xsl:text>
</xsl:template>
</xsl:stylesheet>

it works fine exept it writes the HTML (aspx file) code from the webpage
into the stylesheet. Is there a way to prevent this from happening?

Thanks for your help

Chris
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to cast object of type 'System.Data.DataSet' to Typed DataSet Optimus Microsoft VB .NET 1 31st Jan 2006 06:26 AM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft ADO .NET 7 9th Dec 2003 02:50 PM
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft ADO .NET 2 31st Oct 2003 01:05 PM
copying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft ASP .NET 2 31st Oct 2003 01:05 PM
Ccopying a datatable content from an untyped dataset into a table which is inside a typed dataset Nedu N Microsoft ASP .NET 2 31st Oct 2003 02:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:02 AM.