使 SQL Server Reporting Services 使用指标测量

发布于 2024-08-11 00:46:14 字数 357 浏览 2 评论 0原文

我最近开始使用 SQL Server Reporting Services 创建和编程报告。

有一件事让我立刻感到烦恼:我似乎找不到一种简单的方法来告诉 BIDS(商业智能开发工作室,又名 Visual Studio)使用公制进行测量 - 你知道 - 毫米、厘米等,而不是英寸等。

我试图弄清楚这是否是 Visual Studio 内部的设置(如果是的话:它在哪里??),或者这是否取决于我们要反对的报告服务实例(再说一次:如果是这样,到底在哪里可以我改变它???)。

一定有办法改变这个!!除了美国之外,世界上没有人还在用英寸来测量......来吧——整个世界早已采用公制了!别告诉我微软让我回到黑暗时代......

I'm newly getting into creating and programming reports using SQL Server Reporting Services.

One thing that bugs me right off the bat: I can't seem to find an easy way to tell the BIDS (Business Intelligence Dev Studio, a.k.a. Visual Studio) to use the metric system for measurements - you know - millimeters, centimeters etc., instead of inches and so on.

I was trying to figure out whether that's a setting inside Visual Studio (and if so: where is it??), or whether this depends on the Reporting services instance we're going against (and again: if so, where the heck can I change that???).

There must be a way to change this!! Except for the US, no one in the world is still measuring in inches..... c'mon - the world at large has long since adopted the metric system! Don't tell me Microsoft makes me go back into the dark ages.....

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

无言温柔 2024-08-18 00:46:14

对于 SSRS 2008,编辑 Report.rdl 模板,

<Visual_Studio_Install_dir>\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject

并在结束 标记之前添加以下行:

<rd:ReportUnitType>Cm</rd:ReportUnitType>

这将默认所有新报告(由 Add 创建)新项目 -> 选择报告)以使用厘米。然而,正如 Ed 指出的那样,报告向导创建的报告似乎被硬编码为使用英寸。

其他需要注意的是,您在 Report.rdl 文件中放置的任何内容都将在创建新报告时使用,因此您可以设置默认页面大小、字体等...

For SSRS 2008, edit the Report.rdl template at

<Visual_Studio_Install_dir>\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject

and add the following line before the closing </Report> tag:

<rd:ReportUnitType>Cm</rd:ReportUnitType>

This will default all new reports (created by Add New Item -> select Report) to use centimetres. However, as Ed noted, reports created by the Report Wizard seem to be hard-coded to use inches.

Something else to note is that whatever you place in that Report.rdl file will be used when creating a new report, so you can setup default page sizes, fonts, etc...

海夕 2024-08-18 00:46:14

我知道我正在复活一个长期死亡的线程,但对于那些寻找如何在 VS2010 中执行此操作的人来说,RDL 文件位于稍微不同的位置。

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject\Report.rdl

我在英国,因此发现必须不断从英寸切换到厘米,从“en-US”切换到“en-GB”,这非常烦人。我有时会忘记,直到我的日期栏显示今天是 31 月 7 日时才意识到。为什么 VS 中没有可用的选项来表示“en-GB”是我的默认区域设置,而“cm”是我的默认测量单位,这完全超出了我的理解。微软提供所有主要语言的软件,支持多种日历类型,但随后他们推出了类似的东西,似乎他们假设所有使用 VS 的开发人员都在美国...... ;

我按如下方式修改了 Report.rdl 文件,这解决了该问题,但如前所述,只有在我不使用向导的情况下才可以。我还没有找到任何在向导中设置默认值的方法。在 Report.rdl 旁边的文件夹中有一个名为 ReportWizard.wsz 的文件,但看起来它只包含指向各种对象的指针。那里可能有一些我们可以使用的东西,但我不会屏住呼吸。

我写的报告95%都是A4横向的页面属性,四面边距0.5厘米,没有交互尺寸,顶部有一个标题文本框,所以我也把它们放进去。如果您想复制或修改它以适应需要,这里是整个 Report.rdl 文件。

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <Body>
    <ReportItems>
      <Textbox Name="TextBoxReportTitle">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>Report Title</Value>
                <Style>
                  <FontSize>20pt</FontSize>
                  <FontWeight>Bold</FontWeight>
                  <Color>SteelBlue</Color>
                </Style>
              </TextRun>
            </TextRuns>
            <Style />
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>textbox1</rd:DefaultName>
        <Height>0.9cm</Height>
        <Width>28.7cm</Width>
        <DataElementOutput>NoOutput</DataElementOutput>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
    </ReportItems>
    <Height>5cm</Height>
    <Style />
  </Body>
  <Width>28.7cm</Width>
  <Page>
    <PageHeight>29.7cm</PageHeight>
    <PageWidth>21cm</PageWidth>
    <InteractiveHeight>0cm</InteractiveHeight>
    <InteractiveWidth>0cm</InteractiveWidth>
    <LeftMargin>0.5cm</LeftMargin>
    <RightMargin>0.5cm</RightMargin>
    <TopMargin>0.5cm</TopMargin>
    <BottomMargin>0.5cm</BottomMargin>
    <ColumnSpacing>0.13cm</ColumnSpacing>
    <Style />
  </Page>
  <AutoRefresh>0</AutoRefresh>
  <Language>en-GB</Language>
  <rd:ReportUnitType>Cm</rd:ReportUnitType>
</Report>

如果您有许多经常使用的默认报告设计,则创建新模板非常容易。只需使用您想要的基本外观和所有设置进行快速报告,然后将 rdl 的副本保存到上面我删除了 的文件夹中标签,因为这是自动生成的。现在,如果您要向项目添加新项目,您的新模板将出现在 VS 的列表中。

I know I'm resurrecting a long dead thread, but for those looking for how to do this in VS2010, the RDL file is in a slightly different location.

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject\Report.rdl

I am in the UK, so find it extremely annoying to have to constantly switch from inches to cm and from 'en-US' to 'en-GB'. I sometimes forget and then only realise when my date column says it's the 7th day of the 31st month. Why there is no option available in VS to say 'en-GB' is my default locale and 'cm' is my default measurement unit is entirely beyond me. Microsoft offers their software in all major languages with support for numerous calendar types, but then they pull something like this and it seems they're assuming that all developers using VS are based in the US... </rant>

I modified my Report.rdl file as follows which solves that issue, but as previously mentioned, only if I don't use the wizard. I haven't found any way of setting defaults in the wizard as yet. There is a file called ReportWizard.wsz in the folder alongside the Report.rdl, but it looks like it just contains pointers to various objects. There may be something there we can use, but I'm not going to hold my breath.

95% of the reports I write have the page properties of A4 landscape, 0.5cm margins on all sides and no interactive size, as well as a text box at the top for a title, so I threw them in as well. Here is the entire Report.rdl file if you want to copy it or modify it to suit.

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <Body>
    <ReportItems>
      <Textbox Name="TextBoxReportTitle">
        <CanGrow>true</CanGrow>
        <KeepTogether>true</KeepTogether>
        <Paragraphs>
          <Paragraph>
            <TextRuns>
              <TextRun>
                <Value>Report Title</Value>
                <Style>
                  <FontSize>20pt</FontSize>
                  <FontWeight>Bold</FontWeight>
                  <Color>SteelBlue</Color>
                </Style>
              </TextRun>
            </TextRuns>
            <Style />
          </Paragraph>
        </Paragraphs>
        <rd:DefaultName>textbox1</rd:DefaultName>
        <Height>0.9cm</Height>
        <Width>28.7cm</Width>
        <DataElementOutput>NoOutput</DataElementOutput>
        <Style>
          <Border>
            <Style>None</Style>
          </Border>
          <PaddingLeft>2pt</PaddingLeft>
          <PaddingRight>2pt</PaddingRight>
          <PaddingTop>2pt</PaddingTop>
          <PaddingBottom>2pt</PaddingBottom>
        </Style>
      </Textbox>
    </ReportItems>
    <Height>5cm</Height>
    <Style />
  </Body>
  <Width>28.7cm</Width>
  <Page>
    <PageHeight>29.7cm</PageHeight>
    <PageWidth>21cm</PageWidth>
    <InteractiveHeight>0cm</InteractiveHeight>
    <InteractiveWidth>0cm</InteractiveWidth>
    <LeftMargin>0.5cm</LeftMargin>
    <RightMargin>0.5cm</RightMargin>
    <TopMargin>0.5cm</TopMargin>
    <BottomMargin>0.5cm</BottomMargin>
    <ColumnSpacing>0.13cm</ColumnSpacing>
    <Style />
  </Page>
  <AutoRefresh>0</AutoRefresh>
  <Language>en-GB</Language>
  <rd:ReportUnitType>Cm</rd:ReportUnitType>
</Report>

If you have a number of default report designs you use regularly, it's very easy to make a new template. Just make up a quick report with the basic look you want and all the settings set as you would have them, and save a copy of the rdl to the folder above I removed the <rd:ReportID> tag as this one is automatically generated. Now if you go to add a new item to your project, your new template will appear in the list in VS.

霓裳挽歌倾城醉 2024-08-18 00:46:14

我自己找到了解决方案 - 某种程度上。

创建新报告时,我可以右键单击报告设计图面并选择“报告属性”。在那里,我可以选择英寸和厘米之间的尺寸进行测量。

但我仍然没有找到一种方法来告诉 Reporting Services 我始终默认使用公制......欢迎任何进一步的提示!

I found the solution myself - sort of.

When a new report is created, I can right-click on the report design surface and choose "Report Properties". In there, I can pick between inches and centimeters for my measurements.

But I still haven't found a way to tell Reporting Services that I always want the metric system by default...... any further tips would be welcome!

我们只是彼此的过ke 2024-08-18 00:46:14

我还发现,如果您有现有报告并希望更改这些参数,您可以右键单击报告旁边的空白区域以查看报告属性并将英寸更改为厘米并修改页面大小等。

I have also found that if you have an existing report and wish to change these parameters, you can right click the blank space NEXT to the report to see report properties and change from inches to cm and modify page sizes etc.

剩一世无双 2024-08-18 00:46:14

使用 BIDS 2005(我没有使用过 2008 版本),您可以用设计者理解的任何单位定义测量值 - 在同一个报告中定义一些以英寸为单位的测量值、一些以厘米为单位、一些以像素为单位等都是可以接受的。

如果您查看存储在 RDL 文件(作为 XML)中的报告定义,您将看到该值以您提供的单位存储(而不是在幕后转换为英制测量值) - 如本例所示:

  <InteractiveWidth>8.5in</InteractiveWidth>
  <rd:GridSpacing>0.25cm</rd:GridSpacing>

如果值默认报告模板中的英寸单位打扰您,您可以更改它们 - 在 SQL 2005 中,模板默认存储在

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject\Report.rdl

SQL 2008 中此位置可能略有不同。

(请注意,这不会修改报告生成的报告向导。)

Using BIDS 2005 (I haven't used the 2008 version), you can define measurements in any unit that the designer understands - it's acceptable within the same report to define some measurements in inches, some in centimeters, some in pixels etc.

If you look at the report definition stored in the RDL file (as XML), you'll see that the value is stored in the units you provide (rather than being converted to imperial measurements under the hood) - as in this example:

  <InteractiveWidth>8.5in</InteractiveWidth>
  <rd:GridSpacing>0.25cm</rd:GridSpacing>

If the values in inches in the default report template bother you, you can change them - in SQL 2005, the template is stored by default at

C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\ProjectItems\ReportProject\Report.rdl

This location may be slightly different for SQL 2008.

(Note that this doesn't amend the reports produced by the report wizard.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文