C# DataSet to RichText File
Hi
I'm a beginner and if I'm asking strange things sorry about it.
I read some informations from sql database and display it in my project.
I used sqldataadapter dataset and datagridview.
In my project, in datagridview, I see a table with several columns and rows. And table is full with values.
Until here everything is ok.
Now my problem is I want to move this table to a richtext and save informations. I mean, I want to creat richtext file. There will be a table in richtextfile.
Is it possible to move all table with one code or with one way?
I searched some informations about this stuff.
One way is reading datagrid and creating csv file in excel. It's not good because users don't have excel.
Another way is, reading all informations one by one and converting them to string and make table in text file. This is very long way.
Read colum1row1 and colum1row2 ......................... too much. Also it's not very easy to make tables in txt file.
So I think you understand what I meant.
Can you show me a way to do that ?
Is there a similar project?
Thank you for comments
Re: C# DataSet to RichText File
Quote:
Originally Posted by
pokajy
One way is reading datagrid and creating csv file in excel. It's not good because users don't have excel.
Excel reader is free and csv sounds like the best way to store this data. Many applications know how to read and format csv files, not so with rtf.
Quote:
Another way is, reading all informations one by one and converting them to string and make table in text file. This is very long way.
Read colum1row1 and colum1row2 ......................... too much. Also it's not very easy to make tables in txt file.
Not sure what you mean. That is trivial using a nested loop:
Code:
foreach( string row in Rows )
{
foreach( string column in row.Columns )
{
// print to text file
}
}
Quote:
So I think you understand what I meant.
Not really. RTF sounds like an awful way to store table organized data.
Re: C# DataSet to RichText File
I find excel very cumbersome.
Same table in Txt or rtf 10kb, in excel maybe 100kb.
If it was creating 2-3 files. it's ok. 90kb is nothing, but It'll be kinda reporting and it'll report many times in a day.
I have to install excel to every user who wants to open this files.
I'm not trying to show RTF is good. I'm just trying to explain why I thought about RTF.
Txt does not support tables, I thought it might be possible to send this infos to RTF as table.
If u're saying it's very bad idea. ok then
Re: C# DataSet to RichText File
Quote:
Originally Posted by
pokajy
I find excel very cumbersome.
Same table in Txt or rtf 10kb, in excel maybe 100kb.
I can't imagine how that could possibly be true. A csv file *is* a text file, so it would be smaller than the RTF version. However, you have your reasons, and if you say csv doesn't work for you that's your call.
Have you looked into any of the free/open source reporting tools out there for C#?
Re: C# DataSet to RichText File
yes I saw several reporting examples. Generally people are using csv. It's only me who is abnormal.
Well at the beginning I said that I was a beginner. So don't be angry with strange questions.
Thanks for your help. I'll try creating csv.
Re: C# DataSet to RichText File
I guess my suggestion would be; go with csv :)
Re: C# DataSet to RichText File
Re: C# DataSet to RichText File
Yup :)
The advantage of csv (or tsv, or whatever-sv) is that many, many programs know how to display them nicely and the lend themselves to tabular data.