PradeepYadhav
asked on
height of detail section
Is this possible open an existing crystal report increase the height of the detail section and save it in runtime.
crSection = Report.Sections.Item("D")
how to set the height of this section during runtime ?
Reason is to make the details fit the whole page based on number of records.
crSection = Report.Sections.Item("D")
how to set the height of this section during runtime ?
Reason is to make the details fit the whole page based on number of records.
I don't think it is.
I don't have CR here but if you open a report in Crystal and Right click(left side) the detail section is SIZE an option?
I know if you Click
FORMAT --> FORMAT SECTION
Height is not an option
Is the detail section the same size as the field boxes?
If so you might be able to use an application to
Open the report
Change the size of the field
Save the report
Repeat to set the field height back.
mlmcc
I don't have CR here but if you open a report in Crystal and Right click(left side) the detail section is SIZE an option?
I know if you Click
FORMAT --> FORMAT SECTION
Height is not an option
Is the detail section the same size as the field boxes?
If so you might be able to use an application to
Open the report
Change the size of the field
Save the report
Repeat to set the field height back.
mlmcc
mlmcc he is asking about doing it in the runtime I think.
You can only do this with report application server RAS
//WORKS WELL FOR THE DETAIL AREA GENERATES THE FIELDS
CrystalDecisions.ReportApp Server.Rep ortDefMode l.FieldObj ect field;
Section sec = m_crReportDocument.ReportD efinition. DetailArea .Sections[ 0];
for(int i = 0; i < arr.Count; i++)
{
iField = m_crReportDocument.Databas e.Tables[0 ].DataFiel ds.Find(ar r[i].ToStr ing(), CrFieldDisplayNameTypeEnum .crFieldDi splayNameN ame, CeLocale.ceLocaleUserDefau lt);
field = CreateFieldObject(m_crRepo rtDocument ,(string)a rr[i],tabl eName,4800 *i, 0, 2800, 200);
m_crReportDocument.ReportD efControll er.ReportO bjectContr oller.Add( field, sec, -1);
}
//DOES NOT WORK FOR THE PAGE HEADER AREA GENERATES THE FIELDS
CrystalDecisions.ReportApp Server.Rep ortDefMode l.FieldHea dingObject field;
Section sech = m_crReportDocument.ReportD efinition. PageHeader Area.Secti ons[0];
for(int i = 0; i < arr.Count; i++)
{
field = CreateFieldHeadingObject(( string)arr [i],tableN ame,4800*i , 0, 2800, 200);
m_crReportDocument.ReportD efControll er.ReportO bjectContr oller.Add( field, sech, -1);
}
CrystalReportViewer1.Repor tSource = m_crReportDocument;
FieldObject CreateFieldObject(ReportCl ientDocume nt m_crReportDocument, string strField, string strTable, int left, int top, int width, int height)
{
int iField;
Field oField;
int iTable;
CrystalDecisions.ReportApp Server.Dat aDefModel. Table oTable;
FieldObject field;
CrystalDecisions.ReportApp Server.Rep ortDefMode l.Font font;
CrystalDecisions.ReportApp Server.Rep ortDefMode l.FontColo r fontcolor;
// create a 10 point arial font
font = new CrystalDecisions.ReportApp Server.Rep ortDefMode l.Font();
font.Bold = true;
font.Size = 10;
font.Name = "Tahoma";
// create font color and set font to 10 point arial
fontcolor = new CrystalDecisions.ReportApp Server.Rep ortDefMode l.FontColo r();
fontcolor.Font = font;
// find database field
iTable = m_crReportDocument.Databas e.Tables.F indByAlias (strTable) ;
oTable = (CrystalDecisions.ReportAp pServer.Da taDefModel .Table)m_c rReportDoc ument.Data base.Table s[iTable];
iField = oTable.DataFields.Find(str Field, CrFieldDisplayNameTypeEnum .crFieldDi splayNameN ame, CeLocale.ceLocaleUserDefau lt);
oField = (Field)oTable.DataFields[i Field];
// create field object
field = new FieldObject();
// fill field properties
field.Kind = CrReportObjectKindEnum.crR eportObjec tKindField ;
field.FieldValueType = oField.Type;
field.DataSource = oField.FormulaForm;
field.Left = left;
field.Top = top;
field.Width = width;
field.Height = height;
field.FontColor = fontcolor;
return (field);
}
FieldHeadingObject CreateHeadFieldObject(stri ng strField, string strTable, int left, int top, int width, int height)
{
int iField;
Field oField;
int iTable;
CrystalDecisions.ReportApp Server.Dat aDefModel. Table oTable;
FieldObject field;
CrystalDecisions.ReportApp Server.Rep ortDefMode l.Font font;
CrystalDecisions.ReportApp Server.Rep ortDefMode l.FieldHea dingObject fieldhead;
CrystalDecisions.ReportApp Server.Rep ortDefMode l.FontColo r fontcolor;
// create a 10 point arial font
font = new CrystalDecisions.ReportApp Server.Rep ortDefMode l.Font();
font.Bold = true;
font.Size = 10;
font.Name = "Tahoma";
// create font color and set font to 10 point arial
fontcolor = new CrystalDecisions.ReportApp Server.Rep ortDefMode l.FontColo r();
fontcolor.Font = font;
//CREATE FIELD HEADING OBJECT
fieldhead = new FieldHeadingObject();
fieldhead.FieldObjectName = "test";
fieldhead.Left = left;
fieldhead.Top = top;
fieldhead.Width = width;
fieldhead.Height = height;
fieldhead.FontColor = fontcolor;
fieldhead.Kind = CrReportObjectKindEnum.crR eportObjec tKindField Heading;
return (fieldhead);
}
Regards
Emre
You can only do this with report application server RAS
//WORKS WELL FOR THE DETAIL AREA GENERATES THE FIELDS
CrystalDecisions.ReportApp
Section sec = m_crReportDocument.ReportD
for(int i = 0; i < arr.Count; i++)
{
iField = m_crReportDocument.Databas
field = CreateFieldObject(m_crRepo
m_crReportDocument.ReportD
}
//DOES NOT WORK FOR THE PAGE HEADER AREA GENERATES THE FIELDS
CrystalDecisions.ReportApp
Section sech = m_crReportDocument.ReportD
for(int i = 0; i < arr.Count; i++)
{
field = CreateFieldHeadingObject((
m_crReportDocument.ReportD
}
CrystalReportViewer1.Repor
FieldObject CreateFieldObject(ReportCl
{
int iField;
Field oField;
int iTable;
CrystalDecisions.ReportApp
FieldObject field;
CrystalDecisions.ReportApp
CrystalDecisions.ReportApp
// create a 10 point arial font
font = new CrystalDecisions.ReportApp
font.Bold = true;
font.Size = 10;
font.Name = "Tahoma";
// create font color and set font to 10 point arial
fontcolor = new CrystalDecisions.ReportApp
fontcolor.Font = font;
// find database field
iTable = m_crReportDocument.Databas
oTable = (CrystalDecisions.ReportAp
iField = oTable.DataFields.Find(str
oField = (Field)oTable.DataFields[i
// create field object
field = new FieldObject();
// fill field properties
field.Kind = CrReportObjectKindEnum.crR
field.FieldValueType = oField.Type;
field.DataSource = oField.FormulaForm;
field.Left = left;
field.Top = top;
field.Width = width;
field.Height = height;
field.FontColor = fontcolor;
return (field);
}
FieldHeadingObject CreateHeadFieldObject(stri
{
int iField;
Field oField;
int iTable;
CrystalDecisions.ReportApp
FieldObject field;
CrystalDecisions.ReportApp
CrystalDecisions.ReportApp
CrystalDecisions.ReportApp
// create a 10 point arial font
font = new CrystalDecisions.ReportApp
font.Bold = true;
font.Size = 10;
font.Name = "Tahoma";
// create font color and set font to 10 point arial
fontcolor = new CrystalDecisions.ReportApp
fontcolor.Font = font;
//CREATE FIELD HEADING OBJECT
fieldhead = new FieldHeadingObject();
fieldhead.FieldObjectName = "test";
fieldhead.Left = left;
fieldhead.Top = top;
fieldhead.Width = width;
fieldhead.Height = height;
fieldhead.FontColor = fontcolor;
fieldhead.Kind = CrReportObjectKindEnum.crR
return (fieldhead);
}
Regards
Emre
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER