Make SQL Server Reporting Services use metric measurements

20,759

Solution 1

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...

Solution 2

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.

Solution 3

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!

Solution 4

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.

Solution 5

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.)

Share:
20,759
marc_s
Author by

marc_s

Note to all SO beginner: please absolutely read Jon Skeet's helpful hints on how to write a good question (or at least his short version here) - one that has a chance that someone can answer it. A senior C# / SQL Server / Entity Framework backend developer for line-of-business applications (mostly ASP.NET / ASP.NET Core).

Updated on September 05, 2020

Comments

  • marc_s
    marc_s over 3 years

    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.....

  • marc_s
    marc_s over 14 years
    Thanks! I knew I could define them in any format - but BIDS 2008 still always falls back to inches by default in any new report :-( I'll try your suggestion back at the office tomorrow and I'll let you know!
  • Ian Kemp
    Ian Kemp over 14 years
    Also suggest that Ed's or my answer be marked as the answer to this question.
  • marc_s
    marc_s over 14 years
    Actually, sorry - you're right - half the time :-) When using "Add New Item -> Report", it works; when you do "Add New Report" and then step through the wizard, it doesn't :-( Any idea how to "defaultify" the wizard, too?
  • Doug J. Huras
    Doug J. Huras about 10 years
    Thank you! You wouldn't believe how hard is was to find this tid-bit of info.