繁体   English   中英

如何在Winform中使用CSS格式化Crystal Report?

[英]How to use CSS for formatting Crystal Report in Winform?

我正在将VS 2008用于Winform。 我的项目中有水晶报表,我想借助CSS进行格式化。

谁能为我指出正确的教程来开始这一工作?

适用于Visual Studio的Crystal Reports具有有限的HTML格式。 请参阅本论坛帖子 (有关Google的更多信息 )。 我最近一直在尝试使用HTML在报表上进行某种格式设置,但不幸地发现它甚至不支持div,它仅用于文本格式设置,并且不支持大多数CSS属性。 最后,我不得不使用RTF格式(仅因为我需要Legal Letters的Justify Paragraph选项)。

希望对您有所帮助,

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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM