WebExport.cs 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804
  1. using FastReport.Export.Csv;
  2. using FastReport.Export.Dbf;
  3. using FastReport.Export.Html;
  4. using FastReport.Export.Mht;
  5. using FastReport.Export.Odf;
  6. using FastReport.Export.OoXML;
  7. using FastReport.Export.Pdf;
  8. using FastReport.Export.RichText;
  9. using FastReport.Export.Text;
  10. using FastReport.Export.Xml;
  11. using System;
  12. using System.ComponentModel;
  13. using System.IO;
  14. using System.Text;
  15. using System.Web;
  16. using System.Web.UI;
  17. using System.Web.UI.WebControls;
  18. namespace FastReport.Web
  19. {
  20. public partial class WebReport : WebControl, INamingContainer
  21. {
  22. #region RTF format
  23. /// <summary>
  24. /// Switches a visibility of RTF export in toolbar.
  25. /// </summary>
  26. [DefaultValue(true)]
  27. [Category("Toolbar")]
  28. [Browsable(true)]
  29. public bool ShowRtfExport
  30. {
  31. get { return Prop.ShowRtfExport; }
  32. set { Prop.ShowRtfExport = value; }
  33. }
  34. /// <summary>
  35. /// Gets or sets the quality of Jpeg images in RTF file.
  36. /// </summary>
  37. /// <remarks>
  38. /// Default value is 90. This property will be used if you select Jpeg
  39. /// in the <see cref="RtfImageFormat"/> property.
  40. /// </remarks>
  41. [DefaultValue(90)]
  42. [Category("Rtf Format")]
  43. [Browsable(true)]
  44. public int RtfJpegQuality
  45. {
  46. get { return Prop.RtfJpegQuality; }
  47. set { Prop.RtfJpegQuality = value; }
  48. }
  49. /// <summary>
  50. /// Gets or sets the image format that will be used to save pictures in RTF file.
  51. /// </summary>
  52. /// <remarks>
  53. /// Default value is <b>Metafile</b>. This format is better for exporting such objects as
  54. /// <b>MSChartObject</b> and <b>ShapeObject</b>.
  55. /// </remarks>
  56. [DefaultValue(RTFImageFormat.Metafile)]
  57. [Category("Rtf Format")]
  58. [Browsable(true)]
  59. public RTFImageFormat RtfImageFormat
  60. {
  61. get { return Prop.RtfImageFormat; }
  62. set { Prop.RtfImageFormat = value; }
  63. }
  64. /// <summary>
  65. /// Gets or sets a value indicating that pictures are enabled.
  66. /// </summary>
  67. [DefaultValue(true)]
  68. [Category("Rtf Format")]
  69. [Browsable(true)]
  70. public bool RtfPictures
  71. {
  72. get { return Prop.RtfPictures; }
  73. set { Prop.RtfPictures = value; }
  74. }
  75. /// <summary>
  76. /// Gets or sets a value indicating that page breaks are enabled.
  77. /// </summary>
  78. [DefaultValue(true)]
  79. [Category("Rtf Format")]
  80. [Browsable(true)]
  81. public bool RtfPageBreaks
  82. {
  83. get { return Prop.RtfPageBreaks; }
  84. set { Prop.RtfPageBreaks = value; }
  85. }
  86. /// <summary>
  87. /// Gets or sets a value that determines whether the wysiwyg mode should be used
  88. /// for better results.
  89. /// </summary>
  90. [DefaultValue(true)]
  91. [Category("Rtf Format")]
  92. [Browsable(true)]
  93. public bool RtfWysiwyg
  94. {
  95. get { return Prop.RtfWysiwyg; }
  96. set { Prop.RtfWysiwyg = value; }
  97. }
  98. /// <summary>
  99. /// Gets or sets the creator of the document.
  100. /// </summary>
  101. [DefaultValue("FastReport")]
  102. [Category("Rtf Format")]
  103. [Browsable(true)]
  104. public string RtfCreator
  105. {
  106. get { return Prop.RtfCreator; }
  107. set { Prop.RtfCreator = value; }
  108. }
  109. /// <summary>
  110. /// Gets or sets a value that determines whether the rows in the resulting table
  111. /// should calculate its height automatically.
  112. /// </summary>
  113. [DefaultValue(false)]
  114. [Category("Rtf Format")]
  115. [Browsable(true)]
  116. public bool RtfAutoSize
  117. {
  118. get { return Prop.RtfAutoSize; }
  119. set { Prop.RtfAutoSize = value; }
  120. }
  121. #endregion RTF format
  122. #region MHT format
  123. /// <summary>
  124. /// Switches a visibility of MHT (web-archive) export in toolbar.
  125. /// </summary>
  126. [DefaultValue(true)]
  127. [Category("Toolbar")]
  128. [Browsable(true)]
  129. public bool ShowMhtExport
  130. {
  131. get { return Prop.ShowMhtExport; }
  132. set { Prop.ShowMhtExport = value; }
  133. }
  134. /// <summary>
  135. /// Gets or sets a value indicating that pictures are enabled.
  136. /// </summary>
  137. [DefaultValue(true)]
  138. [Category("Mht Format")]
  139. [Browsable(true)]
  140. public bool MhtPictures
  141. {
  142. get { return Prop.MhtPictures; }
  143. set { Prop.MhtPictures = value; }
  144. }
  145. /// <summary>
  146. /// Gets or sets a value that determines whether the wysiwyg mode should be used
  147. /// for better results.
  148. /// </summary>
  149. [DefaultValue(true)]
  150. [Category("Mht Format")]
  151. [Browsable(true)]
  152. public bool MhtWysiwyg
  153. {
  154. get { return Prop.MhtWysiwyg; }
  155. set { Prop.MhtWysiwyg = value; }
  156. }
  157. #endregion MHT format
  158. #region ODS format
  159. /// <summary>
  160. /// Switches a visibility of Open Office Spreadsheet (ODS) export in toolbar.
  161. /// </summary>
  162. [DefaultValue(true)]
  163. [Category("Toolbar")]
  164. [Browsable(true)]
  165. public bool ShowOdsExport
  166. {
  167. get { return Prop.ShowOdsExport; }
  168. set { Prop.ShowOdsExport = value; }
  169. }
  170. /// <summary>
  171. /// Gets or sets a value indicating that page breaks are enabled.
  172. /// </summary>
  173. [DefaultValue(true)]
  174. [Category("Ods Format")]
  175. [Browsable(true)]
  176. public bool OdsPageBreaks
  177. {
  178. get { return Prop.OdsPageBreaks; }
  179. set { Prop.OdsPageBreaks = value; }
  180. }
  181. /// <summary>
  182. /// Gets or sets a value that determines whether the wysiwyg mode should be used
  183. /// for better results.
  184. /// </summary>
  185. [DefaultValue(true)]
  186. [Category("Ods Format")]
  187. [Browsable(true)]
  188. public bool OdsWysiwyg
  189. {
  190. get { return Prop.OdsWysiwyg; }
  191. set { Prop.OdsWysiwyg = value; }
  192. }
  193. /// <summary>
  194. /// Gets or sets the creator of the document.
  195. /// </summary>
  196. [DefaultValue("FastReport")]
  197. [Category("Ods Format")]
  198. [Browsable(true)]
  199. public string OdsCreator
  200. {
  201. get { return Prop.OdsCreator; }
  202. set { Prop.OdsCreator = value; }
  203. }
  204. #endregion ODS format
  205. #region ODT format
  206. /// <summary>
  207. /// Switches a visibility of Open Office Text (ODT) export in toolbar
  208. /// </summary>
  209. [DefaultValue(true)]
  210. [Category("Toolbar")]
  211. [Browsable(true)]
  212. public bool ShowOdtExport
  213. {
  214. get { return Prop.ShowOdtExport; }
  215. set { Prop.ShowOdtExport = value; }
  216. }
  217. /// <summary>
  218. /// Gets or sets a value indicating that page breaks are enabled.
  219. /// </summary>
  220. [DefaultValue(true)]
  221. [Category("Odt Format")]
  222. [Browsable(true)]
  223. public bool OdtPageBreaks
  224. {
  225. get { return Prop.OdtPageBreaks; }
  226. set { Prop.OdtPageBreaks = value; }
  227. }
  228. /// <summary>
  229. /// Gets or sets a value that determines whether the wysiwyg mode should be used
  230. /// for better results.
  231. /// </summary>
  232. [DefaultValue(true)]
  233. [Category("Odt Format")]
  234. [Browsable(true)]
  235. public bool OdtWysiwyg
  236. {
  237. get { return Prop.OdtWysiwyg; }
  238. set { Prop.OdtWysiwyg = value; }
  239. }
  240. /// <summary>
  241. /// Gets or sets the creator of the document.
  242. /// </summary>
  243. [DefaultValue("FastReport")]
  244. [Category("Odt Format")]
  245. [Browsable(true)]
  246. public string OdtCreator
  247. {
  248. get { return Prop.OdtCreator; }
  249. set { Prop.OdtCreator = value; }
  250. }
  251. #endregion ODT format
  252. #region XPS format
  253. /// <summary>
  254. /// Switches a visibility of XPS export in toolbar.
  255. /// </summary>
  256. [DefaultValue(true)]
  257. [Category("Toolbar")]
  258. [Browsable(true)]
  259. public bool ShowXpsExport
  260. {
  261. get { return Prop.ShowXpsExport; }
  262. set { Prop.ShowXpsExport = value; }
  263. }
  264. #endregion XPS format
  265. #region DBF format
  266. /// <summary>
  267. /// Switches a visibility of DBF export in toolbar.
  268. /// </summary>
  269. [DefaultValue(true)]
  270. [Category("Toolbar")]
  271. [Browsable(true)]
  272. public bool ShowDbfExport
  273. {
  274. get { return Prop.ShowDbfExport; }
  275. set { Prop.ShowDbfExport = value; }
  276. }
  277. #endregion DBF format
  278. #region Word2007 format
  279. /// <summary>
  280. /// Switches a visibility of Word 2007 export in toolbar.
  281. /// </summary>
  282. [DefaultValue(true)]
  283. [Category("Toolbar")]
  284. [Browsable(true)]
  285. public bool ShowWord2007Export
  286. {
  287. get { return Prop.ShowWord2007Export; }
  288. set { Prop.ShowWord2007Export = value; }
  289. }
  290. /// <summary>
  291. /// Enable or disable a matrix view of Word 2007 document.
  292. /// </summary>
  293. [DefaultValue(true)]
  294. [Category("Word 2007 Format")]
  295. [Browsable(true)]
  296. public bool DocxMatrixBased
  297. {
  298. get { return Prop.DocxMatrixBased; }
  299. set { Prop.DocxMatrixBased = value; }
  300. }
  301. /// <summary>
  302. /// Enable or disable the WYSIWYG for Word 2007 document.
  303. /// </summary>
  304. [DefaultValue(true)]
  305. [Category("Word 2007 Format")]
  306. [Browsable(true)]
  307. public bool DocxWysiwyg
  308. {
  309. get { return Prop.DocxWysiwyg; }
  310. set { Prop.DocxWysiwyg = value; }
  311. }
  312. /// <summary>
  313. /// Enable or disable a paragraph view of Word 2007 document.
  314. /// </summary>
  315. [DefaultValue(false)]
  316. [Category("Word 2007 Format")]
  317. [Browsable(true)]
  318. public bool DocxParagraphBased
  319. {
  320. get { return Prop.DocxParagraphBased; }
  321. set { Prop.DocxParagraphBased = value; }
  322. }
  323. /// <summary>
  324. /// Enable or disable the print optimized images in Word 2007 document.
  325. /// </summary>
  326. [DefaultValue(false)]
  327. [Category("Word 2007 Format")]
  328. [Browsable(true)]
  329. public bool DocxPrintOptimized
  330. {
  331. get { return Prop.DocxPrintOptimized; }
  332. set { Prop.DocxPrintOptimized = value; }
  333. }
  334. /// <summary>
  335. /// Gets or sets a value of RowHeightIs Word 2007 document.
  336. /// </summary>
  337. [DefaultValue("")]
  338. [Category("Word 2007 Format")]
  339. [Browsable(true)]
  340. public string DocxRowHeightIs
  341. {
  342. get { return Prop.DocxRowHeightIs; }
  343. set { Prop.DocxRowHeightIs = value; }
  344. }
  345. #endregion Word2007 format
  346. #region Excel2007 format
  347. /// <summary>
  348. /// Switches a visibility of Excel 2007 export in toolbar.
  349. /// </summary>
  350. [DefaultValue(true)]
  351. [Category("Toolbar")]
  352. [Browsable(true)]
  353. public bool ShowExcel2007Export
  354. {
  355. get { return Prop.ShowExcel2007Export; }
  356. set { Prop.ShowExcel2007Export = value; }
  357. }
  358. /// <summary>
  359. /// Gets or sets a value indicating that page breaks are enabled.
  360. /// </summary>
  361. [DefaultValue(false)]
  362. [Category("Excel 2007 Format")]
  363. [Browsable(true)]
  364. public bool XlsxPageBreaks
  365. {
  366. get { return Prop.XlsxPageBreaks; }
  367. set { Prop.XlsxPageBreaks = value; }
  368. }
  369. /// <summary>
  370. /// Gets or sets a value indicating that table without breaks are enabled.
  371. /// </summary>
  372. [DefaultValue(false)]
  373. [Category("Excel 2007 Format")]
  374. [Browsable(true)]
  375. public bool XlsxSeamless
  376. {
  377. get { return Prop.XlsxSeamless; }
  378. set { Prop.XlsxSeamless = value; }
  379. }
  380. /// <summary>
  381. /// Enable or disable the print optimized images in Excel 2007 document.
  382. /// </summary>
  383. [DefaultValue(false)]
  384. [Category("Excel 2007 Format")]
  385. [Browsable(true)]
  386. public bool XlsxPrintOptimized
  387. {
  388. get { return Prop.XlsxPrintOptimized; }
  389. set { Prop.XlsxPrintOptimized = value; }
  390. }
  391. /// <summary>
  392. /// Enable or disable the Print Fit in Excel 2007 document.
  393. /// </summary>
  394. [DefaultValue(false)]
  395. [Category("Excel 2007 Format")]
  396. [Browsable(true)]
  397. public bool XlsxPrintFitPage
  398. {
  399. get { return Prop.XlsxPrintFitPage; }
  400. set { Prop.XlsxPrintFitPage = value; }
  401. }
  402. /// <summary>
  403. /// Gets or sets a value that determines whether the wysiwyg mode should be used
  404. /// for better results.
  405. /// </summary>
  406. [DefaultValue(true)]
  407. [Category("Excel 2007 Format")]
  408. [Browsable(true)]
  409. public bool XlsxWysiwyg
  410. {
  411. get { return Prop.XlsxWysiwyg; }
  412. set { Prop.XlsxWysiwyg = value; }
  413. }
  414. /// <summary>
  415. /// Enable or disable an exporting data without any header/group bands.
  416. /// </summary>
  417. [DefaultValue(true)]
  418. [Category("Excel 2007 Format")]
  419. [Browsable(true)]
  420. public bool XlsxDataOnly
  421. {
  422. get { return Prop.XlsxDataOnly; }
  423. set { Prop.XlsxDataOnly = value; }
  424. }
  425. /// <summary>
  426. /// Enable or disable the Print Fit in Excel 2007 document.
  427. /// </summary>
  428. [DefaultValue(false)]
  429. [Category("Excel 2007 Format")]
  430. [Browsable(true)]
  431. public bool XlsxGroupOnSeparateSheet
  432. {
  433. get { return Prop.XlsxGroupOnSeparateSheet; }
  434. set { Prop.XlsxGroupOnSeparateSheet = value; }
  435. }
  436. #endregion Excel2007 format
  437. #region PowerPoint2007 format
  438. /// <summary>
  439. /// Switches a visibility of PowerPoint 2007 export in toolbar.
  440. /// </summary>
  441. [DefaultValue(true)]
  442. [Category("Toolbar")]
  443. [Browsable(true)]
  444. public bool ShowPowerPoint2007Export
  445. {
  446. get { return Prop.ShowPowerPoint2007Export; }
  447. set { Prop.ShowPowerPoint2007Export = value; }
  448. }
  449. /// <summary>
  450. /// Gets or sets an image format that will be used to save pictures in PowerPoint file.
  451. /// </summary>
  452. [DefaultValue(PptImageFormat.Png)]
  453. [Category("PowerPoint 2007 Format")]
  454. [Browsable(true)]
  455. public PptImageFormat PptxImageFormat
  456. {
  457. get { return Prop.PptxImageFormat; }
  458. set { Prop.PptxImageFormat = value; }
  459. }
  460. #endregion PowerPoint2007 format
  461. #region XML format
  462. /// <summary>
  463. /// Switches a visibility of XML (Excel) export in toolbar.
  464. /// </summary>
  465. [DefaultValue(true)]
  466. [Category("Toolbar")]
  467. [Browsable(true)]
  468. public bool ShowXmlExcelExport
  469. {
  470. get { return Prop.ShowXmlExcelExport; }
  471. set { Prop.ShowXmlExcelExport = value; }
  472. }
  473. /// <summary>
  474. /// Gets or sets a value indicating that page breaks are enabled.
  475. /// </summary>
  476. [DefaultValue(true)]
  477. [Category("Xml Excel Format")]
  478. [Browsable(true)]
  479. public bool XmlExcelPageBreaks
  480. {
  481. get { return Prop.XmlExcelPageBreaks; }
  482. set { Prop.XmlExcelPageBreaks = value; }
  483. }
  484. /// <summary>
  485. /// Gets or sets a value that determines whether the wysiwyg mode should be used
  486. /// for better results.
  487. /// </summary>
  488. [DefaultValue(true)]
  489. [Category("Xml Excel Format")]
  490. [Browsable(true)]
  491. public bool XmlExcelWysiwyg
  492. {
  493. get { return Prop.XmlExcelWysiwyg; }
  494. set { Prop.XmlExcelWysiwyg = value; }
  495. }
  496. /// <summary>
  497. /// Enable or disable an exporting data without any header/group bands.
  498. /// </summary>
  499. [DefaultValue(false)]
  500. [Category("Xml Excel Format")]
  501. [Browsable(true)]
  502. public bool XmlExcelDataOnly
  503. {
  504. get { return Prop.XmlExcelDataOnly; }
  505. set { Prop.XmlExcelDataOnly = value; }
  506. }
  507. #endregion XML format
  508. #region PDF format
  509. /// <summary>
  510. /// Switches a visibility of PDF (Adobe Acrobat) export in toolbar.
  511. /// </summary>
  512. [DefaultValue(true)]
  513. [Category("Toolbar")]
  514. [Browsable(true)]
  515. public bool ShowPdfExport
  516. {
  517. get { return Prop.ShowPdfExport; }
  518. set { Prop.ShowPdfExport = value; }
  519. }
  520. /// <summary>
  521. /// Enable or disable an embedding the TrueType fonts.
  522. /// </summary>
  523. [DefaultValue(true)]
  524. [Category("Pdf Format")]
  525. [Browsable(true)]
  526. public bool PdfEmbeddingFonts
  527. {
  528. get { return Prop.PdfEmbeddingFonts; }
  529. set { Prop.PdfEmbeddingFonts = value; }
  530. }
  531. /// <summary>
  532. /// Enable or disable an export text in curves.
  533. /// </summary>
  534. [DefaultValue(false)]
  535. [Category("Pdf Format")]
  536. [Browsable(true)]
  537. public bool PdfTextInCurves
  538. {
  539. get { return Prop.PdfTextInCurves; }
  540. set { Prop.PdfTextInCurves = value; }
  541. }
  542. /// <summary>
  543. /// Enable or disable an exporting of the background in PDF.
  544. /// </summary>
  545. [DefaultValue(true)]
  546. [Category("Pdf Format")]
  547. [Browsable(true)]
  548. public bool PdfBackground
  549. {
  550. get { return Prop.PdfBackground; }
  551. set { Prop.PdfBackground = value; }
  552. }
  553. /// <summary>
  554. /// Enable or disable the Intercative Forms inside PDF.
  555. /// </summary>
  556. [DefaultValue(false)]
  557. [Category("Pdf Format")]
  558. [Browsable(true)]
  559. public bool PdfInteractiveForms
  560. {
  561. get { return Prop.PdfInteractiveForms; }
  562. set { Prop.PdfInteractiveForms = value; }
  563. }
  564. /// <summary>
  565. /// Enable or disable an optimization the images for printing.
  566. /// </summary>
  567. [DefaultValue(true)]
  568. [Category("Pdf Format")]
  569. [Browsable(true)]
  570. public bool PdfPrintOptimized
  571. {
  572. get { return Prop.PdfPrintOptimized; }
  573. set { Prop.PdfPrintOptimized = value; }
  574. }
  575. /// <summary>
  576. /// Enable or disable a document's Outline.
  577. /// </summary>
  578. [DefaultValue(true)]
  579. [Category("Pdf Format")]
  580. [Browsable(true)]
  581. public bool PdfOutline
  582. {
  583. get { return Prop.PdfOutline; }
  584. set { Prop.PdfOutline = value; }
  585. }
  586. /// <summary>
  587. /// Enable or disable a displaying document's title.
  588. /// </summary>
  589. [DefaultValue(true)]
  590. [Category("Pdf Format")]
  591. [Browsable(true)]
  592. public bool PdfDisplayDocTitle
  593. {
  594. get { return Prop.PdfDisplayDocTitle; }
  595. set { Prop.PdfDisplayDocTitle = value; }
  596. }
  597. /// <summary>
  598. /// Enable or disable a hiding the toolbar.
  599. /// </summary>
  600. [DefaultValue(false)]
  601. [Category("Pdf Format")]
  602. [Browsable(true)]
  603. public bool PdfHideToolbar
  604. {
  605. get { return Prop.PdfHideToolbar; }
  606. set { Prop.PdfHideToolbar = value; }
  607. }
  608. /// <summary>
  609. /// Enable or disable a hiding the menu's bar.
  610. /// </summary>
  611. [DefaultValue(false)]
  612. [Category("Pdf Format")]
  613. [Browsable(true)]
  614. public bool PdfHideMenubar
  615. {
  616. get { return Prop.PdfHideMenubar; }
  617. set { Prop.PdfHideMenubar = value; }
  618. }
  619. /// <summary>
  620. /// Enable or disable a hiding the Windows UI.
  621. /// </summary>
  622. [DefaultValue(false)]
  623. [Category("Pdf Format")]
  624. [Browsable(true)]
  625. public bool PdfHideWindowUI
  626. {
  627. get { return Prop.PdfHideWindowUI; }
  628. set { Prop.PdfHideWindowUI = value; }
  629. }
  630. /// <summary>
  631. /// Enable or disable a fitting the window.
  632. /// </summary>
  633. [DefaultValue(false)]
  634. [Category("Pdf Format")]
  635. [Browsable(true)]
  636. public bool PdfFitWindow
  637. {
  638. get { return Prop.PdfFitWindow; }
  639. set { Prop.PdfFitWindow = value; }
  640. }
  641. /// <summary>
  642. /// Enable or disable a centering the window.
  643. /// </summary>
  644. [DefaultValue(false)]
  645. [Category("Pdf Format")]
  646. [Browsable(true)]
  647. public bool PdfCenterWindow
  648. {
  649. get { return Prop.PdfCenterWindow; }
  650. set { Prop.PdfCenterWindow = value; }
  651. }
  652. /// <summary>
  653. /// Enable or disable a scaling the page for shrink to printable area.
  654. /// </summary>
  655. [DefaultValue(true)]
  656. [Category("Pdf Format")]
  657. [Browsable(true)]
  658. public bool PdfPrintScaling
  659. {
  660. get { return Prop.PdfPrintScaling; }
  661. set { Prop.PdfPrintScaling = value; }
  662. }
  663. /// <summary>
  664. /// Sets the Title of the document.
  665. /// </summary>
  666. [DefaultValue("")]
  667. [Category("Pdf Format")]
  668. [Browsable(true)]
  669. public string PdfTitle
  670. {
  671. get { return Prop.PdfTitle; }
  672. set { Prop.PdfTitle = value; }
  673. }
  674. /// <summary>
  675. /// Sets the Author of the document.
  676. /// </summary>
  677. [DefaultValue("")]
  678. [Category("Pdf Format")]
  679. [Browsable(true)]
  680. public string PdfAuthor
  681. {
  682. get { return Prop.PdfAuthor; }
  683. set { Prop.PdfAuthor = value; }
  684. }
  685. /// <summary>
  686. /// Sets the Subject of the document.
  687. /// </summary>
  688. [DefaultValue("")]
  689. [Category("Pdf Format")]
  690. [Browsable(true)]
  691. public string PdfSubject
  692. {
  693. get { return Prop.PdfSubject; }
  694. set { Prop.PdfSubject = value; }
  695. }
  696. /// <summary>
  697. /// Sets the Keywords of the document.
  698. /// </summary>
  699. [DefaultValue("")]
  700. [Category("Pdf Format")]
  701. [Browsable(true)]
  702. public string PdfKeywords
  703. {
  704. get { return Prop.PdfKeywords; }
  705. set { Prop.PdfKeywords = value; }
  706. }
  707. /// <summary>
  708. /// Sets the Creator of the document.
  709. /// </summary>
  710. [DefaultValue("FastReport")]
  711. [Category("Pdf Format")]
  712. [Browsable(true)]
  713. public string PdfCreator
  714. {
  715. get { return Prop.PdfCreator; }
  716. set { Prop.PdfCreator = value; }
  717. }
  718. /// <summary>
  719. /// Sets the Producer of the document.
  720. /// </summary>
  721. [DefaultValue("FastReport.NET")]
  722. [Category("Pdf Format")]
  723. [Browsable(true)]
  724. public string PdfProducer
  725. {
  726. get { return Prop.PdfProducer; }
  727. set { Prop.PdfProducer = value; }
  728. }
  729. /// <summary>
  730. /// Sets the users password.
  731. /// </summary>
  732. [DefaultValue("")]
  733. [Category("Pdf Format")]
  734. [Browsable(true)]
  735. public string PdfUserPassword
  736. {
  737. get { return Prop.PdfUserPassword; }
  738. set { Prop.PdfUserPassword = value; }
  739. }
  740. /// <summary>
  741. /// Sets the owners password.
  742. /// </summary>
  743. [DefaultValue("")]
  744. [Category("Pdf Format")]
  745. [Browsable(true)]
  746. public string PdfOwnerPassword
  747. {
  748. get { return Prop.PdfOwnerPassword; }
  749. set { Prop.PdfOwnerPassword = value; }
  750. }
  751. /// <summary>
  752. /// Enable or disable a printing in protected document.
  753. /// </summary>
  754. [DefaultValue(true)]
  755. [Category("Pdf Format")]
  756. [Browsable(true)]
  757. public bool PdfAllowPrint
  758. {
  759. get { return Prop.PdfAllowPrint; }
  760. set { Prop.PdfAllowPrint = value; }
  761. }
  762. /// <summary>
  763. /// Enable or disable a modifying in protected document.
  764. /// </summary>
  765. [DefaultValue(true)]
  766. [Category("Pdf Format")]
  767. [Browsable(true)]
  768. public bool PdfAllowModify
  769. {
  770. get { return Prop.PdfAllowModify; }
  771. set { Prop.PdfAllowModify = value; }
  772. }
  773. /// <summary>
  774. /// Enable or disable a copying in protected document.
  775. /// </summary>
  776. [DefaultValue(true)]
  777. [Category("Pdf Format")]
  778. [Browsable(true)]
  779. public bool PdfAllowCopy
  780. {
  781. get { return Prop.PdfAllowCopy; }
  782. set { Prop.PdfAllowCopy = value; }
  783. }
  784. /// <summary>
  785. /// Enable or disable an annotating in protected document.
  786. /// </summary>
  787. [DefaultValue(true)]
  788. [Category("Pdf Format")]
  789. [Browsable(true)]
  790. public bool PdfAllowAnnotate
  791. {
  792. get { return Prop.PdfAllowAnnotate; }
  793. set { Prop.PdfAllowAnnotate = value; }
  794. }
  795. /// <summary>
  796. /// Enable or disable the PDF/A document.
  797. /// </summary>
  798. [DefaultValue(false)]
  799. [Category("Pdf Format")]
  800. [Browsable(true)]
  801. public bool PdfA
  802. {
  803. get { return Prop.PdfA; }
  804. set { Prop.PdfA = value; }
  805. }
  806. /// <summary>
  807. /// Enable or disable a showing of Print Dialog.
  808. /// </summary>
  809. [DefaultValue(false)]
  810. [Category("Pdf Format")]
  811. [Browsable(true)]
  812. public bool PdfShowPrintDialog
  813. {
  814. get { return Prop.PdfShowPrintDialog; }
  815. set { Prop.PdfShowPrintDialog = value; }
  816. }
  817. /// <summary>
  818. /// Enable or disable the Images Original Resolution.
  819. /// </summary>
  820. [DefaultValue(false)]
  821. [Category("Pdf Format")]
  822. [Browsable(true)]
  823. public bool PdfImagesOriginalResolution
  824. {
  825. get { return Prop.PdfImagesOriginalResolution; }
  826. set { Prop.PdfImagesOriginalResolution = value; }
  827. }
  828. /// <summary>
  829. /// Enable or disable the Jpeg Compression.
  830. /// </summary>
  831. [DefaultValue(false)]
  832. [Category("Pdf Format")]
  833. [Browsable(true)]
  834. public bool PdfJpegCompression
  835. {
  836. get { return Prop.PdfJpegCompression; }
  837. set { Prop.PdfJpegCompression = value; }
  838. }
  839. /// <summary>
  840. /// Select a color space (RGB or CMYK)
  841. /// </summary>
  842. [DefaultValue(typeof(PDFExport.PdfColorSpace), "RGB")]
  843. [Category("Pdf Format")]
  844. [Browsable(true)]
  845. public PDFExport.PdfColorSpace PdfColorSpace
  846. {
  847. get { return Prop.PdfColorSpace; }
  848. set { Prop.PdfColorSpace = value; }
  849. }
  850. #endregion PDF format
  851. #region CSV format
  852. /// <summary>
  853. /// Switch visibility the CSV (comma separated values) export in toolbar.
  854. /// </summary>
  855. [DefaultValue(true)]
  856. [Category("Toolbar")]
  857. [Browsable(true)]
  858. public bool ShowCsvExport
  859. {
  860. get { return Prop.ShowCsvExport; }
  861. set { Prop.ShowCsvExport = value; }
  862. }
  863. /// <summary>
  864. /// Gets or sets the cells separator.
  865. /// </summary>
  866. [DefaultValue(";")]
  867. [Category("Csv Format")]
  868. [Browsable(true)]
  869. public string CsvSeparator
  870. {
  871. get { return Prop.CsvSeparator; }
  872. set { Prop.CsvSeparator = value; }
  873. }
  874. /// <summary>
  875. /// Enable or disable an exporting data without any header/group bands.
  876. /// </summary>
  877. [DefaultValue(false)]
  878. [Category("Csv Format")]
  879. [Browsable(true)]
  880. public bool CsvDataOnly
  881. {
  882. get { return Prop.CsvDataOnly; }
  883. set { Prop.CsvDataOnly = value; }
  884. }
  885. #endregion CSV format
  886. #region Prepared report
  887. /// <summary>
  888. /// Switch a visibility of prepared report export in toolbar
  889. /// </summary>
  890. [DefaultValue(true)]
  891. [Category("Toolbar")]
  892. [Browsable(true)]
  893. public bool ShowPreparedReport
  894. {
  895. get { return Prop.ShowPreparedReport; }
  896. set { Prop.ShowPreparedReport = value; }
  897. }
  898. #endregion Prepared report
  899. #region Text format
  900. /// <summary>
  901. /// Switch a visibility of text (plain text) export in toolbar
  902. /// </summary>
  903. [DefaultValue(true)]
  904. [Category("Toolbar")]
  905. [Browsable(true)]
  906. public bool ShowTextExport
  907. {
  908. get { return Prop.ShowTextExport; }
  909. set { Prop.ShowTextExport = value; }
  910. }
  911. /// <summary>
  912. /// Enable or disable an exporting data without any header/group bands.
  913. /// </summary>
  914. [DefaultValue(false)]
  915. [Category("Text Format")]
  916. [Browsable(true)]
  917. public bool TextDataOnly
  918. {
  919. get { return Prop.TextDataOnly; }
  920. set { Prop.TextDataOnly = value; }
  921. }
  922. /// <summary>
  923. /// Gets or sets a value indicating that page breaks are enabled.
  924. /// </summary>
  925. [DefaultValue(true)]
  926. [Category("Text Format")]
  927. [Browsable(true)]
  928. public bool TextPageBreaks
  929. {
  930. get { return Prop.TextPageBreaks; }
  931. set { Prop.TextPageBreaks = value; }
  932. }
  933. /// <summary>
  934. /// Enable or disable the frames in text file.
  935. /// </summary>
  936. [DefaultValue(true)]
  937. [Category("Text Format")]
  938. [Browsable(true)]
  939. public bool TextAllowFrames
  940. {
  941. get { return Prop.TextAllowFrames; }
  942. set { Prop.TextAllowFrames = value; }
  943. }
  944. /// <summary>
  945. /// Enable or disable the simple (non graphic) frames in text file.
  946. /// </summary>
  947. [DefaultValue(true)]
  948. [Category("Text Format")]
  949. [Browsable(true)]
  950. public bool TextSimpleFrames
  951. {
  952. get { return Prop.TextSimpleFrames; }
  953. set { Prop.TextSimpleFrames = value; }
  954. }
  955. /// <summary>
  956. /// Enable or disable an empty lines in text file.
  957. /// </summary>
  958. [DefaultValue(false)]
  959. [Category("Text Format")]
  960. [Browsable(true)]
  961. public bool TextEmptyLines
  962. {
  963. get { return Prop.TextEmptyLines; }
  964. set { Prop.TextEmptyLines = value; }
  965. }
  966. #endregion Text format
  967. #region All exports
  968. private void DoProcessReport()
  969. {
  970. StringBuilder sb = new StringBuilder();
  971. ReportProcess(sb, this.Context);
  972. }
  973. private string GetExportFileName(string format)
  974. {
  975. string s = String.Concat(
  976. Path.GetFileNameWithoutExtension(
  977. Report.FileName.Length == 0 ? WebUtils.ReportPrefix : Report.FileName),
  978. ".",
  979. format);
  980. return s;
  981. }
  982. private void ResponseExport(WebExportItem exportItem, bool displayInline, HttpContext context)
  983. {
  984. WebReport webReport = new WebReport();
  985. WebReportCache exportcache = new WebReportCache(context);
  986. object webReportObject = exportcache.GetObject(exportItem.ReportID, webReport);
  987. if (webReportObject != null)
  988. {
  989. webReport = webReportObject as WebReport;
  990. if (WebUtils.SetupResponse(webReport, context))
  991. {
  992. exportItem.FileName = GetExportFileName(exportItem.Format);
  993. string guid = WebUtils.GetGUID();
  994. exportcache.PutObject(guid, exportItem);
  995. string url = string.Format("~/{0}?{1}={2}&displayinline={3}", WebUtils.HandlerFileName, WebUtils.ConstID, guid, displayInline);
  996. context.Response.Redirect(url, false);
  997. }
  998. }
  999. else
  1000. {
  1001. // 500
  1002. }
  1003. }
  1004. private void ResponseExport(WebExportItem ExportItem, HttpContext context)
  1005. {
  1006. ResponseExport(ExportItem, false, context);
  1007. }
  1008. /// <summary>
  1009. /// Exports in CSV format.
  1010. /// </summary>
  1011. public void ExportCsv()
  1012. {
  1013. ExportCsv(this.Context);
  1014. }
  1015. /// <summary>
  1016. /// Exports in CSV format.
  1017. /// </summary>
  1018. public void ExportCsv(HttpContext context)
  1019. {
  1020. if (State != ReportState.Done)
  1021. DoProcessReport();
  1022. if (State == ReportState.Done && TotalPages > 0)
  1023. {
  1024. WebExportItem exportItem = new WebExportItem();
  1025. exportItem.ReportID = ReportGuid;
  1026. CSVExport csvExport = new CSVExport();
  1027. csvExport.OpenAfterExport = false;
  1028. // set csv export properties
  1029. csvExport.Separator = CsvSeparator;
  1030. csvExport.DataOnly = CsvDataOnly;
  1031. using (MemoryStream ms = new MemoryStream())
  1032. {
  1033. csvExport.Export(Report, ms);
  1034. exportItem.File = ms.ToArray();
  1035. }
  1036. exportItem.Format = "csv";
  1037. exportItem.ContentType = "text/x-csv";
  1038. ResponseExport(exportItem, context);
  1039. }
  1040. }
  1041. /// <summary>
  1042. /// Exports in Text format.
  1043. /// </summary>
  1044. public void ExportText()
  1045. {
  1046. ExportText(this.Context);
  1047. }
  1048. /// <summary>
  1049. /// Exports in Text format.
  1050. /// </summary>
  1051. public void ExportText(HttpContext context)
  1052. {
  1053. if (State != ReportState.Done)
  1054. DoProcessReport();
  1055. if (State == ReportState.Done && TotalPages > 0)
  1056. {
  1057. WebExportItem exportItem = new WebExportItem();
  1058. exportItem.ReportID = ReportGuid;
  1059. TextExport textExport = new TextExport();
  1060. textExport.OpenAfterExport = false;
  1061. // set text export properties
  1062. textExport.AvoidDataLoss = true;
  1063. textExport.DataOnly = TextDataOnly;
  1064. textExport.PageBreaks = TextPageBreaks;
  1065. textExport.Frames = TextAllowFrames;
  1066. textExport.TextFrames = TextSimpleFrames;
  1067. textExport.EmptyLines = TextEmptyLines;
  1068. using (MemoryStream ms = new MemoryStream())
  1069. {
  1070. textExport.Export(Report, ms);
  1071. exportItem.File = ms.ToArray();
  1072. }
  1073. exportItem.Format = "txt";
  1074. exportItem.ContentType = "text/plain";
  1075. ResponseExport(exportItem, context);
  1076. }
  1077. }
  1078. /// <summary>
  1079. /// Exports in DBF format.
  1080. /// </summary>
  1081. public void ExportDbf()
  1082. {
  1083. ExportDbf(this.Context);
  1084. }
  1085. /// <summary>
  1086. /// Exports in DBF format.
  1087. /// </summary>
  1088. public void ExportDbf(HttpContext context)
  1089. {
  1090. if (State != ReportState.Done)
  1091. DoProcessReport();
  1092. if (State == ReportState.Done && TotalPages > 0)
  1093. {
  1094. WebExportItem exportItem = new WebExportItem();
  1095. exportItem.ReportID = ReportGuid;
  1096. DBFExport dbfExport = new DBFExport();
  1097. dbfExport.OpenAfterExport = false;
  1098. // set text export properties
  1099. dbfExport.DataOnly = true;
  1100. using (MemoryStream ms = new MemoryStream())
  1101. {
  1102. dbfExport.Export(Report, ms);
  1103. exportItem.File = ms.ToArray();
  1104. }
  1105. exportItem.Format = "dbf";
  1106. exportItem.ContentType = "application/dbf";
  1107. ResponseExport(exportItem, context);
  1108. }
  1109. }
  1110. /// <summary>
  1111. /// Exports in PDF format.
  1112. /// </summary>
  1113. public void ExportPdf()
  1114. {
  1115. ExportPdf(this.Context, false, PdfShowPrintDialog, false);
  1116. }
  1117. /// <summary>
  1118. /// Exports in PDF format.
  1119. /// </summary>
  1120. public void ExportPdf(bool displayInline)
  1121. {
  1122. ExportPdf(this.Context, displayInline, PdfShowPrintDialog, false);
  1123. }
  1124. /// <summary>
  1125. /// Exports in PDF format.
  1126. /// </summary>
  1127. public void ExportPdf(HttpContext context)
  1128. {
  1129. ExportPdf(context, false, PdfShowPrintDialog, false);
  1130. }
  1131. /// <summary>
  1132. /// Exports in PDF format inline.
  1133. /// </summary>
  1134. public void ExportPdf(HttpContext context, bool displayInline, bool showPrintDialog, bool print)
  1135. {
  1136. if (State != ReportState.Done)
  1137. DoProcessReport();
  1138. if (State == ReportState.Done)
  1139. {
  1140. WebExportItem exportItem = new WebExportItem();
  1141. exportItem.ReportID = this.ReportGuid;
  1142. PDFExport pdfExport = new PDFExport();
  1143. pdfExport.OpenAfterExport = false;
  1144. // set pdf export properties
  1145. pdfExport.EmbeddingFonts = PdfEmbeddingFonts;
  1146. pdfExport.TextInCurves = PdfTextInCurves;
  1147. pdfExport.Background = PdfBackground;
  1148. pdfExport.PrintOptimized = PdfPrintOptimized;
  1149. pdfExport.Title = PdfTitle;
  1150. pdfExport.Author = PdfAuthor;
  1151. pdfExport.Subject = PdfSubject;
  1152. pdfExport.Keywords = PdfKeywords;
  1153. pdfExport.Creator = PdfCreator;
  1154. pdfExport.Producer = PdfProducer;
  1155. pdfExport.Outline = PdfOutline;
  1156. pdfExport.DisplayDocTitle = PdfDisplayDocTitle;
  1157. pdfExport.HideToolbar = PdfHideToolbar;
  1158. pdfExport.HideMenubar = PdfHideMenubar;
  1159. pdfExport.HideWindowUI = PdfHideWindowUI;
  1160. pdfExport.FitWindow = PdfFitWindow;
  1161. pdfExport.CenterWindow = PdfCenterWindow;
  1162. pdfExport.PrintScaling = PdfPrintScaling;
  1163. pdfExport.UserPassword = PdfUserPassword;
  1164. pdfExport.OwnerPassword = PdfOwnerPassword;
  1165. pdfExport.AllowPrint = PdfAllowPrint;
  1166. pdfExport.AllowCopy = PdfAllowCopy;
  1167. pdfExport.AllowModify = PdfAllowModify;
  1168. pdfExport.AllowAnnotate = PdfAllowAnnotate;
  1169. pdfExport.PdfCompliance = PdfA ? PDFExport.PdfStandard.PdfA_2a : PDFExport.PdfStandard.None;
  1170. pdfExport.ShowPrintDialog = showPrintDialog;
  1171. pdfExport.InteractiveForms = PdfInteractiveForms;
  1172. pdfExport.ExportMode = print ? PDFExport.ExportType.WebPrint : PDFExport.ExportType.Export;
  1173. pdfExport.ImagesOriginalResolution = PdfImagesOriginalResolution;
  1174. pdfExport.JpegCompression = PdfJpegCompression;
  1175. pdfExport.ColorSpace = PdfColorSpace;
  1176. using (MemoryStream ms = new MemoryStream())
  1177. {
  1178. pdfExport.Export(Report, ms);
  1179. exportItem.File = ms.ToArray();
  1180. }
  1181. exportItem.Format = "pdf";
  1182. exportItem.ContentType = "application/pdf";
  1183. ResponseExport(exportItem, displayInline, context);
  1184. }
  1185. }
  1186. /// <summary>
  1187. /// Exports in HTML format inline.
  1188. /// </summary>
  1189. public void ExportHtml(HttpContext context, bool displayInline, bool print)
  1190. {
  1191. if (State != ReportState.Done)
  1192. DoProcessReport();
  1193. if (State == ReportState.Done)
  1194. {
  1195. WebExportItem exportItem = new WebExportItem();
  1196. exportItem.ReportID = ReportGuid;
  1197. HTMLExport htmlExport = new HTMLExport();
  1198. htmlExport.CustomDraw += CustomDraw;
  1199. htmlExport.OpenAfterExport = false;
  1200. // set html export properties
  1201. htmlExport.Navigator = false;
  1202. htmlExport.Layers = Layers;
  1203. htmlExport.SinglePage = true;
  1204. htmlExport.Pictures = Pictures;
  1205. htmlExport.Print = print;
  1206. htmlExport.Preview = true;
  1207. htmlExport.SubFolder = false;
  1208. htmlExport.EmbedPictures = EmbedPictures;
  1209. htmlExport.EnableVectorObjects = !WebUtils.IsIE8(context); // don't draw svg barcodes for IE8
  1210. htmlExport.WebImagePrefix = String.Concat(WebUtils.GetAppRoot(context, WebUtils.HandlerFileName), "?", WebUtils.PicsPrefix);
  1211. htmlExport.ExportMode = htmlExport.Print ? HTMLExport.ExportType.WebPrint : HTMLExport.ExportType.Export;
  1212. using (MemoryStream ms = new MemoryStream())
  1213. {
  1214. htmlExport.Export(Report, ms);
  1215. exportItem.File = ms.ToArray();
  1216. }
  1217. if (htmlExport.PrintPageData != null)
  1218. {
  1219. WebReportCache cache = new WebReportCache(this.Context);
  1220. // add all pictures in cache
  1221. for (int i = 0; i < htmlExport.PrintPageData.Pictures.Count; i++)
  1222. {
  1223. Stream stream = htmlExport.PrintPageData.Pictures[i];
  1224. byte[] image = new byte[stream.Length];
  1225. stream.Position = 0;
  1226. int n = stream.Read(image, 0, (int)stream.Length);
  1227. string picGuid = htmlExport.PrintPageData.Guids[i];
  1228. cache.PutObject(picGuid, image);
  1229. }
  1230. // cleanup
  1231. for (int i = 0; i < htmlExport.PrintPageData.Pictures.Count; i++)
  1232. {
  1233. Stream stream = htmlExport.PrintPageData.Pictures[i];
  1234. stream.Dispose();
  1235. stream = null;
  1236. }
  1237. htmlExport.PrintPageData.Pictures.Clear();
  1238. htmlExport.PrintPageData.Guids.Clear();
  1239. }
  1240. exportItem.Format = "html";
  1241. exportItem.ContentType = "text/html";
  1242. ResponseExport(exportItem, displayInline, context);
  1243. }
  1244. }
  1245. /// <summary>
  1246. /// Exports in RTF format.
  1247. /// </summary>
  1248. public void ExportRtf()
  1249. {
  1250. ExportRtf(this.Context);
  1251. }
  1252. /// <summary>
  1253. /// Exports in RTF format.
  1254. /// </summary>
  1255. public void ExportRtf(HttpContext context)
  1256. {
  1257. if (State != ReportState.Done)
  1258. DoProcessReport();
  1259. if (State == ReportState.Done && TotalPages > 0)
  1260. {
  1261. WebExportItem exportItem = new WebExportItem();
  1262. exportItem.ReportID = ReportGuid;
  1263. RTFExport rtfExport = new RTFExport();
  1264. rtfExport.OpenAfterExport = false;
  1265. // set Rtf export properties
  1266. rtfExport.JpegQuality = RtfJpegQuality;
  1267. rtfExport.ImageFormat = RtfImageFormat;
  1268. rtfExport.Pictures = RtfPictures;
  1269. rtfExport.PageBreaks = RtfPageBreaks;
  1270. rtfExport.Wysiwyg = RtfWysiwyg;
  1271. rtfExport.Creator = RtfCreator;
  1272. rtfExport.AutoSize = RtfAutoSize;
  1273. using (MemoryStream ms = new MemoryStream())
  1274. {
  1275. rtfExport.Export(Report, ms);
  1276. exportItem.File = ms.ToArray();
  1277. }
  1278. exportItem.Format = "rtf";
  1279. exportItem.ContentType = "application/rtf";
  1280. ResponseExport(exportItem, context);
  1281. }
  1282. }
  1283. /// <summary>
  1284. /// Exports in MHT format.
  1285. /// </summary>
  1286. public void ExportMht()
  1287. {
  1288. ExportMht(this.Context);
  1289. }
  1290. /// <summary>
  1291. /// Exports in MHT format.
  1292. /// </summary>
  1293. public void ExportMht(HttpContext context)
  1294. {
  1295. if (State != ReportState.Done)
  1296. DoProcessReport();
  1297. if (State == ReportState.Done && TotalPages > 0)
  1298. {
  1299. WebExportItem exportItem = new WebExportItem();
  1300. exportItem.ReportID = ReportGuid;
  1301. MHTExport mhtExport = new MHTExport();
  1302. mhtExport.OpenAfterExport = false;
  1303. // set MHT export properties
  1304. mhtExport.Pictures = MhtPictures;
  1305. mhtExport.Wysiwyg = MhtWysiwyg;
  1306. using (MemoryStream ms = new MemoryStream())
  1307. {
  1308. mhtExport.Export(Report, ms);
  1309. exportItem.File = ms.ToArray();
  1310. }
  1311. exportItem.Format = "mht";
  1312. exportItem.ContentType = "message/rfc822";
  1313. ResponseExport(exportItem, context);
  1314. }
  1315. }
  1316. /// <summary>
  1317. /// Exports in XML (Excel 2003) format.
  1318. /// </summary>
  1319. public void ExportXmlExcel()
  1320. {
  1321. ExportXmlExcel(this.Context);
  1322. }
  1323. /// <summary>
  1324. /// Exports in XML (Excel 2003) format.
  1325. /// </summary>
  1326. public void ExportXmlExcel(HttpContext context)
  1327. {
  1328. if (State != ReportState.Done)
  1329. DoProcessReport();
  1330. if (State == ReportState.Done && TotalPages > 0)
  1331. {
  1332. WebExportItem exportItem = new WebExportItem();
  1333. exportItem.ReportID = ReportGuid;
  1334. XMLExport xmlExport = new XMLExport();
  1335. xmlExport.OpenAfterExport = false;
  1336. // set xml export properties
  1337. xmlExport.PageBreaks = XmlExcelPageBreaks;
  1338. xmlExport.Wysiwyg = XmlExcelWysiwyg;
  1339. xmlExport.DataOnly = XmlExcelDataOnly;
  1340. using (MemoryStream ms = new MemoryStream())
  1341. {
  1342. xmlExport.Export(Report, ms);
  1343. exportItem.File = ms.ToArray();
  1344. }
  1345. exportItem.Format = "xls";
  1346. exportItem.ContentType = "application/vnd.ms-excel";
  1347. ResponseExport(exportItem, context);
  1348. }
  1349. }
  1350. /// <summary>
  1351. /// Exports in Open Office Spreadsheet format.
  1352. /// </summary>
  1353. public void ExportOds()
  1354. {
  1355. ExportOds(this.Context);
  1356. }
  1357. /// <summary>
  1358. /// Exports in Open Office Spreadsheet format.
  1359. /// </summary>
  1360. public void ExportOds(HttpContext context)
  1361. {
  1362. if (State != ReportState.Done)
  1363. DoProcessReport();
  1364. if (State == ReportState.Done && TotalPages > 0)
  1365. {
  1366. WebExportItem exportItem = new WebExportItem();
  1367. exportItem.ReportID = ReportGuid;
  1368. ODSExport odsExport = new ODSExport();
  1369. odsExport.OpenAfterExport = false;
  1370. // set ODS export properties
  1371. odsExport.Creator = OdsCreator;
  1372. odsExport.Wysiwyg = OdsWysiwyg;
  1373. odsExport.PageBreaks = OdsPageBreaks;
  1374. using (MemoryStream ms = new MemoryStream())
  1375. {
  1376. odsExport.Export(Report, ms);
  1377. exportItem.File = ms.ToArray();
  1378. }
  1379. exportItem.Format = "ods";
  1380. exportItem.ContentType = "application/x-oleobject";
  1381. ResponseExport(exportItem, context);
  1382. }
  1383. }
  1384. /// <summary>
  1385. /// Exports in Open Office Text format.
  1386. /// </summary>
  1387. public void ExportOdt()
  1388. {
  1389. ExportOdt(this.Context);
  1390. }
  1391. /// <summary>
  1392. /// Exports in Open Office Text format.
  1393. /// </summary>
  1394. public void ExportOdt(HttpContext context)
  1395. {
  1396. if (State != ReportState.Done)
  1397. DoProcessReport();
  1398. if (State == ReportState.Done && TotalPages > 0)
  1399. {
  1400. WebExportItem exportItem = new WebExportItem();
  1401. exportItem.ReportID = ReportGuid;
  1402. ODTExport odtExport = new ODTExport();
  1403. odtExport.OpenAfterExport = false;
  1404. // set ODT export properties
  1405. odtExport.Creator = OdtCreator;
  1406. odtExport.Wysiwyg = OdtWysiwyg;
  1407. odtExport.PageBreaks = OdtPageBreaks;
  1408. using (MemoryStream ms = new MemoryStream())
  1409. {
  1410. odtExport.Export(Report, ms);
  1411. exportItem.File = ms.ToArray();
  1412. }
  1413. exportItem.Format = "odt";
  1414. exportItem.ContentType = "application/x-oleobject";
  1415. ResponseExport(exportItem, context);
  1416. }
  1417. }
  1418. /// <summary>
  1419. /// Exports in XPS format.
  1420. /// </summary>
  1421. public void ExportXps()
  1422. {
  1423. ExportXps(this.Context);
  1424. }
  1425. /// <summary>
  1426. /// Exports in XPS format.
  1427. /// </summary>
  1428. public void ExportXps(HttpContext context)
  1429. {
  1430. if (State != ReportState.Done)
  1431. DoProcessReport();
  1432. if (State == ReportState.Done && TotalPages > 0)
  1433. {
  1434. WebExportItem exportItem = new WebExportItem();
  1435. exportItem.ReportID = ReportGuid;
  1436. XPSExport xpsExport = new XPSExport();
  1437. xpsExport.OpenAfterExport = false;
  1438. using (MemoryStream ms = new MemoryStream())
  1439. {
  1440. xpsExport.Export(Report, ms);
  1441. exportItem.File = ms.ToArray();
  1442. }
  1443. exportItem.Format = "xps";
  1444. exportItem.ContentType = "application/vnd.ms-xpsdocument";
  1445. ResponseExport(exportItem, context);
  1446. }
  1447. }
  1448. /// <summary>
  1449. /// Exports in Excel 2007 format.
  1450. /// </summary>
  1451. public void ExportExcel2007()
  1452. {
  1453. ExportExcel2007(this.Context);
  1454. }
  1455. /// <summary>
  1456. /// Exports in Excel 2007 format.
  1457. /// </summary>
  1458. public void ExportExcel2007(HttpContext context)
  1459. {
  1460. if (State != ReportState.Done)
  1461. DoProcessReport();
  1462. if (State == ReportState.Done && TotalPages > 0)
  1463. {
  1464. WebExportItem exportItem = new WebExportItem();
  1465. exportItem.ReportID = ReportGuid;
  1466. Excel2007Export xlsxExport = new Excel2007Export();
  1467. xlsxExport.OpenAfterExport = false;
  1468. // set Excel 2007 export properties
  1469. xlsxExport.PageBreaks = XlsxPageBreaks;
  1470. xlsxExport.Seamless = XlsxSeamless;
  1471. xlsxExport.DataOnly = XlsxDataOnly;
  1472. xlsxExport.GroupOnSeparateSheet = XlsxGroupOnSeparateSheet;
  1473. xlsxExport.PrintOptimized = XlsxPrintOptimized;
  1474. xlsxExport.PrintFit = XlsxPrintFitPage ?
  1475. Excel2007Export.PrintFitMode.FitSheetOnOnePage : Excel2007Export.PrintFitMode.NoScaling;
  1476. xlsxExport.Wysiwyg = XlsxWysiwyg;
  1477. using (MemoryStream ms = new MemoryStream())
  1478. {
  1479. xlsxExport.Export(Report, ms);
  1480. exportItem.File = ms.ToArray();
  1481. }
  1482. exportItem.Format = "xlsx";
  1483. exportItem.ContentType = "application/vnd.ms-excel";
  1484. ResponseExport(exportItem, context);
  1485. }
  1486. }
  1487. /// <summary>
  1488. /// Exports in Word 2007 format.
  1489. /// </summary>
  1490. public void ExportWord2007()
  1491. {
  1492. ExportWord2007(this.Context);
  1493. }
  1494. /// <summary>
  1495. /// Exports in Word 2007 format.
  1496. /// </summary>
  1497. public void ExportWord2007(HttpContext context)
  1498. {
  1499. if (State != ReportState.Done)
  1500. DoProcessReport();
  1501. if (State == ReportState.Done && TotalPages > 0)
  1502. {
  1503. WebExportItem exportItem = new WebExportItem();
  1504. exportItem.ReportID = ReportGuid;
  1505. Word2007Export docxExport = new Word2007Export();
  1506. docxExport.OpenAfterExport = false;
  1507. docxExport.Wysiwyg = DocxWysiwyg;
  1508. // set Word 2007 export properties
  1509. docxExport.MatrixBased = DocxMatrixBased;
  1510. docxExport.ParagraphBased = DocxParagraphBased;
  1511. docxExport.PrintOptimized = DocxPrintOptimized;
  1512. if (!String.IsNullOrEmpty(DocxRowHeightIs) && DocxRowHeightIs.ToLower() == "min")
  1513. docxExport.RowHeight = Word2007Export.RowHeightType.Minimum;
  1514. else
  1515. docxExport.RowHeight = Word2007Export.RowHeightType.Exactly;
  1516. using (MemoryStream ms = new MemoryStream())
  1517. {
  1518. docxExport.Export(Report, ms);
  1519. exportItem.File = ms.ToArray();
  1520. }
  1521. exportItem.Format = "docx";
  1522. exportItem.ContentType = "application/vnd.ms-word";
  1523. ResponseExport(exportItem, context);
  1524. }
  1525. }
  1526. /// <summary>
  1527. /// Exports in PowerPoint 2007 format.
  1528. /// </summary>
  1529. public void ExportPowerPoint2007()
  1530. {
  1531. ExportPowerPoint2007(this.Context);
  1532. }
  1533. /// <summary>
  1534. /// Exports in PowerPoint 2007 format.
  1535. /// </summary>
  1536. public void ExportPowerPoint2007(HttpContext context)
  1537. {
  1538. if (State != ReportState.Done)
  1539. DoProcessReport();
  1540. if (State == ReportState.Done && TotalPages > 0)
  1541. {
  1542. WebExportItem exportItem = new WebExportItem();
  1543. exportItem.ReportID = ReportGuid;
  1544. PowerPoint2007Export pptxExport = new PowerPoint2007Export();
  1545. pptxExport.OpenAfterExport = false;
  1546. // set Power Point 2007 properties
  1547. pptxExport.ImageFormat = PptxImageFormat;
  1548. using (MemoryStream ms = new MemoryStream())
  1549. {
  1550. pptxExport.Export(Report, ms);
  1551. exportItem.File = ms.ToArray();
  1552. }
  1553. exportItem.Format = "pptx";
  1554. exportItem.ContentType = "application/vnd.ms-powerpoint ";
  1555. ResponseExport(exportItem, context);
  1556. }
  1557. }
  1558. /// <summary>
  1559. /// Exports in prepared report.
  1560. /// </summary>
  1561. public void ExportPrepared()
  1562. {
  1563. ExportPrepared(this.Context);
  1564. }
  1565. /// <summary>
  1566. /// Exports in prepared report.
  1567. /// </summary>
  1568. public void ExportPrepared(HttpContext context)
  1569. {
  1570. if (State != ReportState.Done)
  1571. DoProcessReport();
  1572. if (State == ReportState.Done && TotalPages > 0)
  1573. {
  1574. WebExportItem exportItem = new WebExportItem();
  1575. exportItem.ReportID = ReportGuid;
  1576. using (MemoryStream ms = new MemoryStream())
  1577. {
  1578. Report.SavePrepared(ms);
  1579. exportItem.File = ms.ToArray();
  1580. }
  1581. exportItem.Format = "fpx";
  1582. exportItem.ContentType = "application/octet-stream";
  1583. ResponseExport(exportItem, context);
  1584. }
  1585. }
  1586. /// <summary>
  1587. /// Prints in Adobe Acrobat.
  1588. /// </summary>
  1589. public void PrintPdf()
  1590. {
  1591. ExportPdf(this.Context, true, true, true);
  1592. }
  1593. /// <summary>
  1594. /// Prints in Adobe Acrobat.
  1595. /// </summary>
  1596. public void PrintPdf(HttpContext context)
  1597. {
  1598. ExportPdf(context, true, true, true);
  1599. }
  1600. /// <summary>
  1601. /// Prints in Adobe Acrobat.
  1602. /// </summary>
  1603. public void PrintPdf(bool showPrintDialog)
  1604. {
  1605. ExportPdf(this.Context, true, showPrintDialog, true);
  1606. }
  1607. /// <summary>
  1608. /// Prints in Adobe Acrobat.
  1609. /// </summary>
  1610. public void PrintPdf(HttpContext context, bool showPrintDialog)
  1611. {
  1612. ExportPdf(context, true, showPrintDialog, true);
  1613. }
  1614. /// <summary>
  1615. /// Prints in browser.
  1616. /// </summary>
  1617. public void PrintHtml()
  1618. {
  1619. ExportHtml(this.Context, true, true);
  1620. }
  1621. /// <summary>
  1622. /// Prints in browser.
  1623. /// </summary>
  1624. public void PrintHtml(HttpContext context)
  1625. {
  1626. ExportHtml(context, true, true);
  1627. }
  1628. #endregion All exports
  1629. }
  1630. }