Symptom
-
Adding a TextObject and changing the horizontal alignment
-
Report Creation API (RC API)
-
RAS .NET SDK
Environment
-
Visual Studio .NET 2003 or 2005
- Crystal Reports XI R2 SP2
-
Crystal Reports 2008
Using the RAS .NET SDK to add a TextObject then change the
HorizontalAlignment doesn't work.
eg.
Paragraphs boParagraphs;
Paragraph boParagraph;
ParagraphTextElement boParagraphTextElement;
CrystalDecisions.ReportAppServer.ReportDefModel.TextObject boTextObject;
CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;
ReportObjectController boReportObjectController;
Paragraph boParagraph;
ParagraphTextElement boParagraphTextElement;
CrystalDecisions.ReportAppServer.ReportDefModel.TextObject boTextObject;
CrystalDecisions.ReportAppServer.ReportDefModel.Section boSection;
ReportObjectController boReportObjectController;
boReportDocument.Load(Server.MapPath("CrystalReport.rpt"));
boReportClientDocument = boReportDocument.ReportClientDocument;
boReportObjectController = boReportClientDocument.ReportDefController.ReportObjectController;
boReportClientDocument = boReportDocument.ReportClientDocument;
boReportObjectController = boReportClientDocument.ReportDefController.ReportObjectController;
boTextObject = new CrystalDecisions.ReportAppServer.ReportDefModel.TextObject();
boTextObject.Width = 5000;
boTextObject.Border.LeftLineStyle = CrLineStyleEnum.crLineStyleSingle;
boTextObject.Border.RightLineStyle = CrLineStyleEnum.crLineStyleSingle;
boTextObject.Top = 10;
boTextObject.Left = 10;
boTextObject.Format.EnableCanGrow = true;
boParagraphs = new Paragraphs();
boParagraph = new Paragraph();
boParagraphTextElement = new ParagraphTextElement();
// Configure paragraph 1
boParagraphTextElement.Text = "This is some right aligned text";
boParagraph.Alignment = CrAlignmentEnum.crAlignmentRight;
boParagraph.ParagraphElements.Add(boParagraphTextElement);
boParagraphs.Add(boParagraph);
boParagraphTextElement.Text = "This is some right aligned text";
boParagraph.Alignment = CrAlignmentEnum.crAlignmentRight;
boParagraph.ParagraphElements.Add(boParagraphTextElement);
boParagraphs.Add(boParagraph);
// Configure paragraph 2
boParagraphTextElement = new ParagraphTextElement();
boParagraphTextElement.Text = "this is another paragraph left aligned";
boParagraph = new Paragraph();
boParagraph.Alignment = CrAlignmentEnum.crAlignmentLeft;
boParagraph.ParagraphElements.Add(boParagraphTextElement);
boParagraphs.Add(boParagraph);
boParagraphTextElement = new ParagraphTextElement();
boParagraphTextElement.Text = "this is another paragraph left aligned";
boParagraph = new Paragraph();
boParagraph.Alignment = CrAlignmentEnum.crAlignmentLeft;
boParagraph.ParagraphElements.Add(boParagraphTextElement);
boParagraphs.Add(boParagraph);
// Add the Paragraphs to the TextObject
boTextObject.Paragraphs = boParagraphs;
boTextObject.Paragraphs = boParagraphs;
// Attempt to set the text
alignment for theTextObject as left aligned.
// You'll notice that this doesn't impact the text alignment.
boTextObject.Format.HorizontalAlignment = CrAlignmentEnum.crAlignmentRight;
// You'll notice that this doesn't impact the text alignment.
boTextObject.Format.HorizontalAlignment = CrAlignmentEnum.crAlignmentRight;
// Get the ReportHeader section
boSection = boReportClientDocument.ReportDefinition.ReportHeaderArea.Sections[0];
// Add the TextObject to the ReportHeader
boReportObjectController.Add(boTextObject, boSection, 1);
boSection = boReportClientDocument.ReportDefinition.ReportHeaderArea.Sections[0];
// Add the TextObject to the ReportHeader
boReportObjectController.Add(boTextObject, boSection, 1);
Read more...
Product
Crystal Reports 2008 V0 ; Crystal Reports Server XI R2 ; Crystal Reports Server XI R2, OEM edition ; SAP BusinessObjects Business Intelligence platform R2 ; SAP BusinessObjects Enterprise XI ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2 ; SAP Crystal Server XI
Keywords
TEXT OBJECT TEXTOBJECT ALIGN ALIGNMENT RIGHT LEFT JUSTIFY NET .NET DOTNET RAS RCAPI RC API MODIFY CHANGE , 5716712 , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , Bug Filed
About this page
This is a preview of a SAP Knowledge Base Article. Click more to access the full version on SAP for Me (Login required).Search for additional results
Visit SAP Support Portal's SAP Notes and KBA Search.