首页 > 解决方案 > 为什么 excel 发布的静态 html 文件在 Amazon s3 上具有内容类型八位字节?

问题描述

我做了足够多的编程来惹上麻烦。我写了一些 excel VBA 来将选定的范围、图表等发布到静态网页。当目标是 iCloud 并且我稍后将文件复制到 S3 存储桶时一切都很好,扩展名为 .html 的文件是 S3 类型的 text/html。如果我将宏中的路径直接设置为 s3 存储桶(使用 Cloudberry 将存储桶安装为驱动器),则内容类型为八位字节。我看不出有办法在 excel/vba 中解决这个问题,但我可能错了。有什么方法可以在 S3 端进行设置吗?部分通过代码是:

    outputfile = "X:\WebPublishedicloud\" & PageName & ".html"
    ' publish file
    If PubTyp = 1 Then
         With ActiveWorkbook.PublishObjects.Add(SourceType:=xlSourceSheet, _
        Filename:=outputfile, Sheet:=sheetname, _
        HtmlType:=xlHtmlStatic)
        .publish
        .AutoRepublish = True
        End With
    ElseIf PubTyp = 5 Then
        With ActiveWorkbook.PublishObjects.Add(SourceType:=xlSourceChart, _
            Filename:=outputfile, Sheet:=sheetname, _
            HtmlType:=xlHtmlStatic)
            .publish
            .AutoRepublish = True
        End With
    ElseIf PubTyp = 4 Then
        Set Pubrange = ActiveSheet.Range(Addr)
        PubrangeA = Pubrange.Address
        With ActiveWorkbook.PublishObjects.Add(SourceType:=xlSourceRange, _
            Filename:=outputfile, Sheet:=sheetname, _
            Source:=Pubrange.Address, _
            HtmlType:=xlHtmlStatic)
            .publish (True)
            .AutoRepublish = True
        End With`

标签: excelamazon-s3

解决方案


推荐阅读