Skip to Content
author's profile photo Former Member
Former Member

Page (Paper) format in Print Layout Designer

Hi there,

I am creating a report which is 3 pages long and i need to give different page format for each page i,e 1st page is A4 Portrait, 2nd page is A4 Landscape and the 3rd one again A4 Portrait.

any ideas how to do this?

Regards,

Narayan

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Oct 17, 2006 at 03:28 AM

    Hi Narayan,

    I'm pretty sure you cannot do this within the same report in PLD. It may be possible to do in some third-party report writers. Alternatively you could try writing 3 separate reports and chaining them together programatically (eg you could write 3 Crystal reports and write an add-on that runs all 3 reports in sequence).

    Hope this helps,

    Owen

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Noor,

      If you use Crystal for your reports then you can program the Crystal API to print each report to a particular printer. I've done this before and it works perfectly. I recommend you store the report and printer names in a user-defined table so they can be easily modified by the users. Then read these values before printing each report. The only thing to watch out for is that each user must have the same name for the printer on their local machine.

      The following is an example for printing a report to a pre-defined printer (C# with Crystal 10):

      string sPrinter = "";

      string sUser = "";

      string sPassword = "";

      // Code goes here to read printer, user and password settings from the database (note: encrypt the password!)

      try

      {

      m_rptCrystal = new CrystalDecisions.CrystalReports.Engine.ReportDocument();

      m_rptCrystal.Load(System.Windows.Forms.Application.StartupPath.ToString() + "
      MyReport.rpt");

      if(sPrinter != "") m_rptCrystal.PrintOptions.PrinterName = sPrinter; // Blank = user's default printer

      SetCrystalLogin(sUser, sPassword, m_sboCompany.Server, m_sboCompany.CompanyDB, ref m_rptCrystal);

      SetCrystalParams("@MyParam", MyValue, ref m_rptCrystal);

      m_rptCrystal.PrintToPrinter(1, false, 0, 0);

      m_sboApp.SetStatusBarMessage("MyReport sent to printer...", SAPbouiCOM.BoMessageTime.bmt_Short, false);

      }

      catch(Exception ex)

      {

      m_sboApp.SetStatusBarMessage("Print error: " + ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, true);

      }

      private void SetCrystalLogin(string sUser, string sPassword, string sServer, string sCompanyDB,

      ref CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt)

      {

      CrystalDecisions.CrystalReports.Engine.Database oDB = oRpt.Database;

      CrystalDecisions.CrystalReports.Engine.Tables oTables = oDB.Tables;

      CrystalDecisions.Shared.TableLogOnInfo oLogonInfo;

      CrystalDecisions.Shared.ConnectionInfo oConnectInfo = new CrystalDecisions.Shared.ConnectionInfo();

      oConnectInfo.DatabaseName = sCompanyDB;

      oConnectInfo.ServerName = sServer;

      oConnectInfo.UserID = sUser;

      oConnectInfo.Password = sPassword;

      foreach(CrystalDecisions.CrystalReports.Engine.Table oTable in oTables)

      {

      oLogonInfo = oTable.LogOnInfo;

      oLogonInfo.ConnectionInfo = oConnectInfo;

      oTable.ApplyLogOnInfo(oLogonInfo);

      }

      }

      private void SetCrystalParams(string sFieldName, int iVal, ref CrystalDecisions.CrystalReports.Engine.ReportDocument oRpt)

      {

      CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinitions oFieldDefs;

      CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition oFieldDef;

      CrystalDecisions.Shared.ParameterValues oParamVals;

      CrystalDecisions.Shared.ParameterDiscreteValue oDiscreteVal;

      oFieldDefs = oRpt.DataDefinition.ParameterFields;

      oFieldDef = oFieldDefs[sFieldName];

      oParamVals = oFieldDef.CurrentValues;

      oParamVals.Clear();

      oDiscreteVal = new CrystalDecisions.Shared.ParameterDiscreteValue();

      oDiscreteVal.Value = iVal;

      oParamVals.Add(oDiscreteVal);

      oFieldDef.ApplyCurrentValues(oParamVals);

      }

      Hope this helps,

      Owen

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.