gc.spread.excelio.d.ts 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. declare module GC{
  2. module Spread{
  3. module Excel{
  4. export class IO{
  5. /**
  6. * Represents an excel import and export class.
  7. * @class
  8. */
  9. constructor();
  10. /**
  11. * Imports an excel file.
  12. * @param {Blob} file The excel file.
  13. * @param {function} successCallBack Call this function after successfully loading the file. function (json) { }.
  14. * @param {function} errorCallBack Call this function if an error occurs. The exception parameter object structure { errorCode: GC.Spread.Excel.IO.ErrorCode, errorMessage: string}.
  15. * @param {Object} [options] The options for import excel.
  16. * @param {string} [options.password] the excel file's password.
  17. * @returns {void}
  18. */
  19. open(file: Blob, successCallBack: Function, errorCallBack?: Function, options?: any): void;
  20. /**
  21. * Creates and saves an excel file with the SpreadJS json.
  22. * @param {object} json The spread sheets json object, or string.
  23. * @param {function} successCallBack Call this function after successfully exporting the file. function (blob) { }.
  24. * @param {function} [errorCallBack] Call this function if an error occurs. The exception parameter object structure { errorCode: GC.Spread.Excel.IO.ErrorCode, errorMessage: string}.
  25. * @param {Object} [options] The options for export excel.
  26. * @param {string} [options.password] the excel file's password.
  27. * @returns {void}
  28. */
  29. save(json: String, successCallBack: Function, errorCallBack?: Function, options?: any): void;
  30. }
  31. module IO{
  32. /**
  33. * Specifies the excel io error code.
  34. * @enum {number}
  35. */
  36. export enum ErrorCode{
  37. /**
  38. * File read and write exception.
  39. */
  40. fileIOError= 0,
  41. /**
  42. * Incorrect file format.
  43. */
  44. fileFormatError= 1,
  45. /**
  46. * The Excel file cannot be opened because the workbook/worksheet is password protected.
  47. */
  48. noPassword= 2,
  49. /**
  50. * The specified password is incorrect.
  51. */
  52. invalidPassword= 3
  53. }
  54. }
  55. }
  56. }
  57. }