|
|
|
Опять экспорт из CR в Excel и pdf
|
|||
|---|---|---|---|
|
#18+
Экспортирую отчет CrystalReport в Word так. ReportDocument rd = new ReportDocument(); ... protected void btWord_Click(object sender, EventArgs e) { Stream myStream = rd.ExportToStream(ExportFormatType.WordForWindows); StreamReader r = new StreamReader(myStream); try { Response.Clear(); Response.ContentType = "application/vnd.ms-word"; Response.AddHeader("Content-Disposition", "attachment; filename=Report.doc"); String str = r.ReadToEnd(); Response.Write(str); Response.Flush(); } finally { Response.End(); } } Все работает хорошо. ------------------------------------------------------------------------------- Экспортирую отчет CrystalReport в Excel так. protected void btExcel_Click(object sender, EventArgs e) { Stream myStream = rd.ExportToStream(ExportFormatType.Excel); StreamReader r = new StreamReader(myStream); try { Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment; filename=Report.xls"); String str = r.ReadToEnd(); Response.Write(str); Response.Flush(); } finally { Response.End(); } } Все не работает, говорит неправильный формат файла. Аналогично с pdf. Что не так? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 14.01.2009, 16:41 |
|
||
|
|

start [/forum/topic.php?fid=31&fpage=93&tid=1536443]: |
0ms |
get settings: |
4ms |
get forum list: |
9ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
44ms |
get topic data: |
5ms |
get forum data: |
1ms |
get page messages: |
13ms |
get tp. blocked users: |
1ms |
| others: | 212ms |
| total: | 293ms |

| 0 / 0 |
