Skip to Content
avatar image
Former Member

Set Font and Size of all Report Text before extraction

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 13, 2017 at 03:26 PM

    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

    Add comment
    10|10000 characters needed characters exceeded