Page 1 of 1
Problem when Generate Report CSV
Posted: Fri Jul 06, 2007 9:58 am
by ricardohtg
Hi,
I need to generate report in CSV extension, but the title in report appears the textname and not the textvalue.
For example...
in report generate with CSV extension:
Text1 Text2 Text3 Text4
Carlos 3332565 São Paulo 12356
in report generate with XLS extension:
Name Phone City Adress Number
Carlos 3332565 São Paulo 12356
Problem when Generate Report CSV
Posted: Sat Jul 07, 2007 5:47 am
by Edward
For CSV and DBF and XML export you should set the following in the
Tag property of the StiText component:
Code: Select all
CSV: "ColumnHeader";DBF: "ColumnHeader";XML: "ColumnHeader"
Thank you.
Problem when Generate Report CSV
Posted: Tue Jul 10, 2007 3:56 pm
by ricardohtg
Thank´s for resolve my problem..
Edward wrote:For CSV and DBF and XML export you should set the following in the
Tag property of the StiText component:
Code: Select all
CSV: "ColumnHeader";DBF: "ColumnHeader";XML: "ColumnHeader"
Thank you.
Problem when Generate Report CSV
Posted: Wed Jul 11, 2007 7:17 am
by Edward
Let me know if you need any help.
Thank you.
Problem when Generate Report CSV
Posted: Mon Nov 16, 2009 4:45 pm
by Colin Geis
I am having the same problem. That is, column headers are not showing in .CSV files.
Could you please give an example of the C# code needed to set the Tag propery?
Thank you.
Problem when Generate Report CSV
Posted: Tue Nov 17, 2009 6:35 am
by Ivan
Hello,
You can use following code, for example:
Code: Select all
StiReport report = new StiReport();
report.Load(@"D:\Report.mrt");
StiText text1 = report.GetComponentByName("textBox1") as StiText;
text1.Tag.Value = "CSV: \"ColumnHeaderName\";";
report.Render();
report.ExportDocument(StiExportFormat.Csv, @"d:\report.csv");
Thank you.
Problem when Generate Report CSV
Posted: Wed Jan 06, 2010 12:42 pm
by Colin Geis
Greetings!
Thank you very much.
The code example you gave to show column headers in .CSV files worked excellent using a band based solution (clarifying the use of double quotes within a string).
e.g.
StiHeaderBand headerBand = new StiHeaderBand();
StiText headerText = new StiText(new RectangleD(colStartPos, 0.5, colWidth, 0.5));
headerText.Text = colInfo.caption;
...
StiDataBand dataBand = new StiDataBand();
StiText dataText = new StiText(new RectangleD(colStartPos, 0, colWidth, 0.5));
dataText.Text = "{" + tableInfo.tableName + "." + colInfo.fieldName + "}";
...
string captionWithoutNewLine = colInfo.caption.Replace("\n", " ");
dataText.Tag.Value = "CSV: \"" + captionWithoutNewLine + "\";";
dataText.Tag.Value += "DBF: \"" + captionWithoutNewLine + "\";";
...
dataBand.Components.Add(dataText);
However, I am now using the same solution but with the new Table component...
e.g.
StiTable table = new StiTable();
table.Name = "Table1";
...
int indexHeaderCell = 0;
int indexDataCell = tableInfo.columnInfo.Count;
foreach (ColInformation colInfo in tableInfo.columnInfo)
{
StiTableCell headerCell = table.Components[indexHeaderCell] as StiTableCell;
headerCell.Text.Value = colInfo.caption;
...
StiTableCell dataCell = table.Components[indexDataCell] as StiTableCell;
dataCell.Text.Value = "{view" + tableInfo.tableName + "." + colInfo.fieldName + "}";
...
string captionWithoutNewLine = colInfo.caption.Replace("\n", " ");
dataCell.Tag.Value = "CSV: \"" + captionWithoutNewLine + "\";";
dataCell.Tag.Value += "DBF: \"" + captionWithoutNewLine + "\";";
...
indexHeaderCell++;
indexDataCell++;
}
with end result being column headers still not being displayed properly in .CSV files.
e.g.
Table1_Cell13 Table1_Cell14 Table1_Cell15 Table1_Cell16 Table1_Cell17
Roads Low C-Zone I3E 1322
C-Zone I3W 1301
In summary, I have the solution to show column headers in CSV files working with StiDataBand but not StiTable. So, if you could explain how to get column headers working for CSV files generated using StiTable it would be greatly appreciated.
Thank you in advance.
Problem when Generate Report CSV
Posted: Thu Jan 14, 2010 10:04 am
by Ivan
Hello,
We made some improvements in that direction.
Please check the next prerelease build when it will be available and let us know about the result.
Thank you.