Generating text files

G

Guest

Do you have to generate a huge file?

If you don't have to generate a big number of rows an elegant solution could
be to use XSL (you can have the input in XML and apply your XSL template to
export to your given format):

About XSL solution:
http://www.codeproject.com/vbscript/xml2csv.asp
http://www.stylusstudio.com/xmldev/200404/post60210.html

XSL Tutorial:
http://www.w3schools.com/xsl/

The strong point of this solution is that if you need any change in the
future on the style of the output you will have only to modify this XSL.

On the other hand if you have to manage with a lot of rows better go
manually with a loop, and write the ouput into an stream.

http://www.csharp-station.com/HowTo/ReadWriteTextFile.aspx
http://aspnet.4guysfromrolla.com/articles/072303-1.aspx

Good Luck
Braulio

/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------
 
P

Paulo

Hi, I have to do a LayOut text files, to send to a financial institute...

Each line has defined columns, example position 1 lenght 2 - string content
/ position 3 - date content (ddmmaaaa)... numeric contents (15,2), etc

Do you know the best form doing that? any examples? components?

Thanks

Using VS 2005 - asp.net 2.0 C#
 
G

Guest

If you use a Dataset you will get the XML format for free, then you can
create an XSL template.

If I where in your shoes, I would make a simple proof of concept version
using XSL + XML Datasets and check if the response times are good.

HTH
Braulio

/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------
 
P

Paulo

No, it´s not a big file, I hope maximum 1 or 2 MegaByte... I have to loop
some tables and build the strings to make the file...
 
R

Rad [Visual C# MVP]

Hi, I have to do a LayOut text files, to send to a financial institute...

Each line has defined columns, example position 1 lenght 2 - string content
/ position 3 - date content (ddmmaaaa)... numeric contents (15,2), etc

Do you know the best form doing that? any examples? components?

Thanks

Using VS 2005 - asp.net 2.0 C#

Take a look at an excellent library called FileHelpers -- perfect for
this kind of thing

http://filehelpers.sourceforge.net/
 

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