RTFImportPlugin.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. namespace FastReport.Design.ImportPlugins.RTF
  2. {
  3. /// <summary>
  4. /// Import RichTextFile to a report
  5. /// </summary>
  6. public class RTFImportPlugin : ImportPlugin
  7. {
  8. #region Constructors
  9. /// <summary>
  10. /// Initializes a new instance of the <see cref="RTFImportPlugin"/> class.
  11. /// </summary>
  12. public RTFImportPlugin() : base()
  13. {
  14. }
  15. /// <summary>
  16. /// Initializes a new instance of the <see cref="RTFImportPlugin"/> class with a specified designer.
  17. /// </summary>
  18. /// <param name="designer">The report designer.</param>
  19. public RTFImportPlugin(Designer designer) : base(designer)
  20. {
  21. }
  22. #endregion
  23. #region Protected Methods
  24. /// <inheritdoc/>
  25. protected override string GetFilter()
  26. {
  27. return new Utils.MyRes("FileFilters").Get("RtfFile");
  28. }
  29. #endregion // Protected Methods
  30. #region Public Methods
  31. /// <inheritdoc/>
  32. public override void LoadReport(Report report, string filename)
  33. {
  34. ImportRtf rtf_convertor = new ImportRtf(filename);
  35. rtf_convertor.ResetProperties();
  36. Report = rtf_convertor.CreateReport();
  37. Report.FileName = filename + ".frx";
  38. Report.Save(Report.FileName);
  39. Designer.cmdOpen.LoadFile(Report.FileName);
  40. }
  41. #endregion // Public Methods
  42. }
  43. }