import React, { useEffect } from 'react';
import { ExportExcel, ExportExcelZip } from '../index';
import { Button } from 'antd';
const ExportExcelDemo = (props) => {
  const exportExcelBtn = () => {
    ExportExcel({
      name: '下载Excel',
      content: [
        {
          sheetData: [
            { one: '一行一列', two: '一行二列' },
            { one: '二行一列', two: '二行二列' },
          ],
          sheetName: 'sheet1',
          sheetFilter: ['two', 'one'],
          sheetHeader: ['第一列', '第二列'],
          columnWidths: [20, 20],
        },
        {
          sheetData: [
            { one: '一行一列', two: '一行二列' },
            { one: '二行一列', two: '二行二列' },
          ],
          sheetName: 'sheet2',
          sheetFilter: ['one', 'two'],
          sheetHeader: ['第一列', '第二列'],
          columnWidths: [20, 20],
        },
      ],
    });
  };
  const exportExcelZipBtn = () => {
    ExportExcelZip({
      name: '下载Excel',
      content: [
        {
          sheetData: [
            { one: '一行一列', two: '一行二列' },
            { one: '二行一列', two: '二行二列' },
          ],
          sheetName: 'sheet1',
          sheetFilter: ['two', 'one'],
          sheetHeader: ['第一列', '第二列'],
          columnWidths: [20, 20],
        },
        {
          sheetData: [
            { one: '一行一列', two: '一行二列' },
            { one: '二行一列', two: '二行二列' },
          ],
          sheetName: 'sheet2',
          sheetFilter: ['one', 'two'],
          sheetHeader: ['第一列', '第二列'],
          columnWidths: [20, 20],
        },
      ],
    });
  };
  return (
    <>
      <Button onClick={exportExcelBtn} style={{ marginRight: '10px' }}>
        下载Excel
      </Button>
      <Button onClick={exportExcelZipBtn}>下载压缩Excel</Button>
    </>
  );
};
export default ExportExcelDemo;
