0

我正在使用 VS 2008 作为 Winform。我在项目中有水晶报告,我想在 CSS 的帮助下对其进行格式化。

谁能指出我正确的教程来开始这个?

4

2 回答 2

2

Crystal Reports for Visual Studio 的 HTML 格式有限。看到这个论坛帖子(谷歌更多)。我最近一直在尝试使用 HTML 对我的报告进行一些格式化,但遗憾地发现它甚至不支持 div,它仅用于文本格式,并且大多数 CSS 属性不受支持。最后我不得不使用 RTF 格式(只是因为我需要 Legal Letters 的 Justify Paragraph 选项)。

希望有帮助,

于 2013-03-01T07:39:24.400 回答
-1

CSS 仅适用于 Web 应用程序。如果要自定义 Windows 应用程序的外观,可以使用 XML 文件或资源文件。将控件的所有设置指定到 XML 或 res 文件中,并在加载窗口应用程序表单时在运行时使用此文件。

示例 xml

<?xml version="1.0" encoding="utf-8" ?>
<StylesSheetFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                 xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Styles>
        <Style Name="FormType1">
            <Properties>
                <Property Name="BackColor" Value="White" />
                <Property Name="Text" Value="Personal information" />
                <Property Name="Enabled" Value="true" />
            </Properties>
        </Style>
        <Style Name="DataGridType1">
            <Properties>
                <Property Name="RowsDefaultCellStyle.BackColor" 
                          Value="White" />
                <Property Name="AlternatingRowsDefaultCellStyle.BackColor" 
                          Value="214,222,247" />
                <Property Name="Columns[0].HeaderText" 
                          Value="Color name" />
                <Property Name="Columns[1].HeaderText" Value="My rate" />
            </Properties>
        </Style>
        <Style Name="TabControlType1">
            <Properties>
                <Property Name="Enabled" Value="true" />
                <Property Name="TabPages[0].BackColor" Value="White" />
                <Property Name="TabPages[1].BackColor" Value="White" />
                <Property Name="TabPages[2].BackColor" Value="White" />
            </Properties>
        </Style>
        <Style Name="LabelType1">
            <Properties>
                <Property Name="TextAlign" Value="TopLeft" />
                <Property Name="BorderStyle" Value="None" />
                <Property Name="ForeColor" Value="72,94,158" />
                <Property Name="Font" 
                          Value="Microsoft Sans Serif,8.25pt,style=Regular" />
                <Property Name="Height" Value="20" />
                <Property Name="Enabled" Value="true" />
            </Properties>
        </Style>
        <Style Name="LabelType2">
            <Properties>
                <Property Name="ForeColor" Value="Red" />
                <Property Name="Font" 
                          Value="Microsoft Sans Serif,8.25pt,style=Bold" />
            </Properties>
        </Style>
        <Style Name="TextBoxType1">
            <Properties>
                <Property Name="TextAlign" Value="Left" />
                <Property Name="BorderStyle" Value="Fixed3D" />
                <Property Name="Font" Value="Tahoma,10,style=Regular" />
                <Property Name="Height" Value="20" />
                <Property Name="Width" Value="200" />
                <Property Name="BackColor" Value="214, 222, 247" />
            </Properties>
        </Style>
        <Style Name="HyperLinkType1">
            <Properties>
                <Property Name="BorderStyle" Value="None" />
                <Property Name="ForeColor" Value="Blue" />
                <Property Name="Font" 
                          Value="Tahoma,10,style=Italic,Underline" />
                <Property Name="Height" Value="30" />
                <Property Name="Width" Value="200" />
                <Property Name="Enabled" Value="true" />
            </Properties>
        </Style>
        <Style Name="ButtonType1">
            <Properties>
                <Property Name="TextAlign" Value="TopLeft" />
                <Property Name="ForeColor" Value="Black" />
                <Property Name="BackColor" Value="214;222;247" />
                <Property Name="Font" Value="Tahoma,8.25,style=Italic" />
                <Property Name="Height" Value="23" />
                <Property Name="Enabled" Value="true" />
            </Properties>
        </Style>
        <Style Name="ComboBoxType1">
            <Properties>
                <Property Name="BackColor" Value="White" />
                <Property Name="Font" Value="Tahoma,10,style=Italic" />
                <Property Name="Height" Value="30" />
                <Property Name="Width" Value="200" />
                <Property Name="Enabled" Value="true" />
            </Properties>
        </Style>
        <Style Name="RadioButtonType1">
            <Properties>
                <Property Name="ForeColor" Value="Blue" />
                <Property Name="Font" Value="Verdana,8,style=Regular" />
                <Property Name="Width" Value="150" />
                <Property Name="Enabled" Value="true" />
            </Properties>
        </Style>
    </Styles>
</StylesSheetFile>
于 2013-02-28T05:08:25.553 回答