【问题标题】:Reading object directly from AWS S3 bucket and return workbook using SpreadsheetGear直接从 AWS S3 存储桶读取对象并使用 SpreadsheetGear 返回工作簿
【发布时间】:2020-04-23 22:55:27
【问题描述】:

Excel 文件可以从 S3 下载到网络服务器,然后可以填充到 Spreadsheetgear 工作簿对象中。但是,我正在尝试从存储在 S3 存储桶中的 excel 文件中读取字节或流数组并填充工作簿对象。

【问题讨论】:

    标签: c# .net asp.net-mvc amazon-s3 spreadsheetgear


    【解决方案1】:

    得到了我需要的东西:

     public static SpreadsheetGear.IWorkbook GetObjectFromS3AndReturnWorkbook(string key, string path, string bucketName)
            {
                GetObjectResponse response = client.GetObject(bucketName, key);
                MemoryStream memoryStream = new MemoryStream();
    
                using (Stream responseStream = response.ResponseStream)
                {
                    responseStream.CopyTo(memoryStream);
                }
                IWorkbookSet workbookSet = Factory.GetWorkbookSet();
                SpreadsheetGear.IWorkbook workbook = workbookSet.Workbooks.OpenFromStream(memoryStream);
                return workbook;
            }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-11
      • 2019-07-08
      • 1970-01-01
      • 2020-05-22
      • 2015-02-02
      • 2015-09-12
      • 2018-01-09
      • 2022-01-13
      相关资源
      最近更新 更多