从SQL Server报表服务器导出非Unicode CSV

时间:2021-08-11 08:01:30

I am using the SQL Server Report Server from Microsoft SQL Server 2005.

我正在使用Microsoft SQL Server 2005中的SQL Server报表服务器。

In the report server report viewer control, there is a CSV download option. The CSV download option is currently downloading a Unicode CSV file, which does not load into Microsoft Excel with the correct column formatting.

在报表服务器报表查看器控件中,有一个CSV下载选项。 CSV下载选项当前正在下载Unicode CSV文件,该文件无法使用正确的列格式加载到Microsoft Excel中。

If I save the Unicode CSV file and convert it to a ASCII file it works fine in Excel.

如果我保存Unicode CSV文件并将其转换为ASCII文件,它在Excel中工作正常。

How can I can I set a report or the SSRS Report Viewer to export CSV as ASCII instead of Unicode?

如何设置报告或SSRS报告查看器以将CSV导出为ASCII而不是Unicode?

Thanks in advance for any help with this.

在此先感谢您的帮助。

4 个解决方案

#1


Go to the RSReportserver.config file (should be in the root of your reportserver virtual directory e.g. "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer")

转到RSReportserver.config文件(应位于reportserver虚拟目录的根目录中,例如“C:\ Program Files \ Microsoft SQL Server \ MSSQL.3 \ Reporting Services \ ReportServer”)

Find the CSV Extension - should look something like below. Change the Encoding node to read ASCII instead of Unicode or whatevr you have in there.

找到CSV扩展程序 - 应该如下所示。将Encoding节点更改为读取ASCII而不是Unicode或whatevr。

        <Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering">
            <Configuration>
                <DeviceInfo>
                    <Encoding>Unicode</Encoding>
                </DeviceInfo>
            </Configuration>
        </Extension>

#2


More information at http://msdn.microsoft.com/en-us/library/ms156281.aspx. You can create multiple extensions, i.e. in addition to the default "CSV" you can add "CSV - ASCII" or "CSV - Pipe" etc.

有关更多信息,请访问http://msdn.microsoft.com/en-us/library/ms156281.aspx。您可以创建多个扩展名,即除了默认的“CSV”之外,您还可以添加“CSV - ASCII”或“CSV - 管道”等。

#3


Just for completeness here's how you go about adding a "CSV-ANSI" export option.You'll need to add an "OverrideNames" tag so that you don't get duplicate "CSV" options. As I'm in Australia I needed to add a "en-AU" language option, you can remove it if you don't need it (or replace with your own language).

为了完整起见,您可以在此处添加“CSV-ANSI”导出选项。您需要添加“OverrideNames”标记,这样您才能获得重复的“CSV”选项。因为我在澳大利亚,我需要添加一个“en-AU”语言选项,如果你不需要它,你可以删除它(或用你自己的语言替换)。

<Extension Name="CSV-UTF8" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
    <OverrideNames>
        <Name Language="en-US">CSV (UTF8)</Name>
        <Name Language="en-AU">CSV (UTF8)</Name>
    </OverrideNames>                
</Extension>

<Extension Name="CSV-ANSI" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
    <OverrideNames>
        <Name Language="en-US">CSV (ANSI)</Name>
        <Name Language="en-AU">CSV (ANSI)</Name>
    </OverrideNames>                
    <Configuration>     
        <DeviceInfo>
            <Encoding>ASCII</Encoding>
        </DeviceInfo>
    </Configuration>
</Extension>

#4


In the save button there is small drop down menu which says "Save with encoding" where you can specify the encoding type as ansi ~Ram

在保存按钮中有一个小的下拉菜单,上面写着“使用编码保存”,您可以在其中指定编码类型为ansi~Ram

#1


Go to the RSReportserver.config file (should be in the root of your reportserver virtual directory e.g. "C:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer")

转到RSReportserver.config文件(应位于reportserver虚拟目录的根目录中,例如“C:\ Program Files \ Microsoft SQL Server \ MSSQL.3 \ Reporting Services \ ReportServer”)

Find the CSV Extension - should look something like below. Change the Encoding node to read ASCII instead of Unicode or whatevr you have in there.

找到CSV扩展程序 - 应该如下所示。将Encoding节点更改为读取ASCII而不是Unicode或whatevr。

        <Extension Name="CSV" Type="Microsoft.ReportingServices.Rendering.CsvRenderer.CsvReport,Microsoft.ReportingServices.CsvRendering">
            <Configuration>
                <DeviceInfo>
                    <Encoding>Unicode</Encoding>
                </DeviceInfo>
            </Configuration>
        </Extension>

#2


More information at http://msdn.microsoft.com/en-us/library/ms156281.aspx. You can create multiple extensions, i.e. in addition to the default "CSV" you can add "CSV - ASCII" or "CSV - Pipe" etc.

有关更多信息,请访问http://msdn.microsoft.com/en-us/library/ms156281.aspx。您可以创建多个扩展名,即除了默认的“CSV”之外,您还可以添加“CSV - ASCII”或“CSV - 管道”等。

#3


Just for completeness here's how you go about adding a "CSV-ANSI" export option.You'll need to add an "OverrideNames" tag so that you don't get duplicate "CSV" options. As I'm in Australia I needed to add a "en-AU" language option, you can remove it if you don't need it (or replace with your own language).

为了完整起见,您可以在此处添加“CSV-ANSI”导出选项。您需要添加“OverrideNames”标记,这样您才能获得重复的“CSV”选项。因为我在澳大利亚,我需要添加一个“en-AU”语言选项,如果你不需要它,你可以删除它(或用你自己的语言替换)。

<Extension Name="CSV-UTF8" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
    <OverrideNames>
        <Name Language="en-US">CSV (UTF8)</Name>
        <Name Language="en-AU">CSV (UTF8)</Name>
    </OverrideNames>                
</Extension>

<Extension Name="CSV-ANSI" Type="Microsoft.ReportingServices.Rendering.DataRenderer.CsvReport,Microsoft.ReportingServices.DataRendering">
    <OverrideNames>
        <Name Language="en-US">CSV (ANSI)</Name>
        <Name Language="en-AU">CSV (ANSI)</Name>
    </OverrideNames>                
    <Configuration>     
        <DeviceInfo>
            <Encoding>ASCII</Encoding>
        </DeviceInfo>
    </Configuration>
</Extension>

#4


In the save button there is small drop down menu which says "Save with encoding" where you can specify the encoding type as ansi ~Ram

在保存按钮中有一个小的下拉菜单,上面写着“使用编码保存”,您可以在其中指定编码类型为ansi~Ram