on 04-13-2017 4:10 PM
Dear all,
I've a problem with Calibri font that I couldn't face off in the new server.
The most safety (but not the most beauty) solution is to convert all the .rpt in a copy with Arial Font instead Calibri one.
However, we have A LOT of report and this is a huge work to be done.
I would ask you so if there is a quickly way to set Font and Size of all character in a report before extraction, when it is called by a .NET procedure.
Cordially,
Trezzi Alessandro
As I posted in the other thread, there is a way to do this in C#. Load the report into a ReportDocument object and then do the following:
Font regularFont = new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular);
Font headerFont = new Font(FontFamily.GenericSansSerif, 12, FontStyle.Bold);
foreach (Section section in procRpt.ReportDefinition.Sections)
{
foreach(ReportObject rptObj in section.ReportObjects)
{
switch (rptObj.Kind)
{
case ReportObjectKind.FieldObject:
FieldObject fldObj = (FieldObject) rptObj;
fldObj.ApplyFont(regularFont);
break;
case ReportObjectKind.FieldHeadingObject:
FieldHeadingObject fhObj = (FieldHeadingObject) rptObj;
fhObj.ApplyFont(headerFont);
break;
default:
break;
}
}
}
I didn't find a way to update the objects in a CrossTab, so you may have to manually update any reports that use them.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank's a lot Stinnet,
The logic of this piece of code is, if I've understood, that you're setting Bold style in header and regular style in other fields?
There is no way to set a Font variable without the third input, the FontStyle? In this way I'm expecting that all words that is Bold in a FieldObject will become Regular.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.