Skip to Content
0
Former Member
Apr 07, 2009 at 03:09 PM

set style for reports

38 Views

Hello

i need to find a way to give a format to objects inside my reports, in a way similar to css.

Actually i export my reports in the code behind of my page, i wish to set the report sytle (font size and type, color, backgroung and so on). I've tried to use the setcssclass method in the code behind of the page that export the pdf without success :

the page:

<head id="Head1" runat="server">
<title></title>
<style type="text/css" runat="server" id="stile">
    h1
    {
    background-color:Aqua;
    border-color:Black;
    color:Black;
    font-family:Arial;
    font-weight:bold;
    font-style:italic;
    }
</style>
</head>

the code behind

report.SetCssClass(ObjectScope.PageHeaderSections,"h1")
Dim oStream As System.IO.MemoryStream
oStream = DirectCast(report.ExportToStream( _
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat), System.IO.MemoryStream)
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/pdf"
Response.BinaryWrite(oStream.ToArray())

I wish to remark i don't use crystalreportviewer and the above code print the file directly inside the browser.

the questions are:

1. does the above code should work and i'm doing something wrong or that approach is completly wrong and will never work? If it's a correct approach, why the stye doesn't get applied?

2. if that's not the rigth way to do this thing what tool should i use? formatting formulas? do them allow me to format large pieces of report at the same time like css do in html ? Can you provide me links to examples or tutorial.

i'd like to avoid to set font size,type , line thickness or colors for each item in the report, so any hint will be greatly appreciated

thank you in advance

Stefano