Solved

Crystal Reports: Programmatically change graphic in PageHeaderSection

Posted on 2012-04-03
3
580 Views
Last Modified: 2012-05-10
Software: Visual Studio 2005 Crystal Reports.

I have an application written in VB.Net, Sql Server and use Crystal Reports for printing several custom designed documents.

I would like to sell the application but may have a problem with the printing because each document has unique company names and logos in the ReportHeaderSection and the PageHeaderSection.

It would take a long time to change the information for each user manually - is there a way to do this programmically with code?

Thanks!
0
Comment
Question by:dave_sky
3 Comments
 
LVL 5

Accepted Solution

by:
hafeezmca earned 500 total points
ID: 37803370
This solution applies if you are using a plain old C# Object to populate your Crystal Reports (see http://www.aspfree.com/c/a/C-Sharp/Crystal-Reports-for-Visual-Studio-2005-in-CSharp/  for info on this approach).

In your C# class, insert the following code:

private static byte[] m_Bitmap = null;

public byte[] Bitmap
{
   get
   {
      FileStream fs = new FileStream(bitmapPath, FileMode.Open);
      BinaryReader br = new BinaryReader(fs);
      int length = (int)br.BaseStream.Length;
      m_Bitmap = new byte[length];
      m_Bitmap = br.ReadBytes(length);
      br.Close();
      fs.Close();
      return m_Bitmap;
   }
}

Now, update your C# Object Mapping in CR using the "Verify Database" option. You should then see the Bitmap property as a CR field. Just drag it onto the form. It will be of type IBlobFieldObject. When you run, you should see your image.

Reference:  http://stackoverflow.com/questions/128239/dynamically-change-an-image-in-a-crystal-report-at-runtime
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help with a Crystal Report in my C#.Net application 2 27
SQL Query Help Top 1 and Distinct? 6 35
Open a link in vb.net 2 16
Install IIS7.5 on Windows Sever 2012 R2 4 23
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question