how to set crossheader and crossdataband in page center?

Stimulsoft Reports.NET discussion
Post Reply
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

how to set crossheader and crossdataband in page center?

Post by amitkaushik »

I am looking to put the crossheader and crossdataband in page center dynamicly when report created.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: how to set crossheader and crossdataband in page center?

Post by HighAley »

Hello.

There is no simple way to center CrossHeaderBand and CrossDataBand.

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: how to set crossheader and crossdataband in page center?

Post by amitkaushik »

will you have any suggession for it.

I am looking to center line all the controls and bands on report specialy I have multiple crossdataband with crossheader.
As per the functionality crossdataband work from left to right, but in the case of one record i want to align it in center of page not in left. I need your suggession on it.

Thank you.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: how to set crossheader and crossdataband in page center?

Post by Alex K. »

Hello,

Please send us your report with test data which reproduces the issue for analysis.

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: how to set crossheader and crossdataband in page center?

Post by amitkaushik »

Please find the report and images.

DataBase Script is here:

create TABLE [dbo].[Product](
[ProductID] [int] IDENTITY(1,1) NOT NULL,
[ProductName] [varchar](50) NOT NULL,
[CompantName] [varchar](50) NOT NULL
)

insert into [dbo].[Product] values('Prod1','Comp1')
insert into [dbo].[Product] values('Prod2','Comp2')
insert into [dbo].[Product] values('Prod3','Comp3')
insert into [dbo].[Product] values('Prod4','Comp4')
insert into [dbo].[Product] values('Prod5','Comp5')

--------------------------------------------------------------------------

Create FUNCTION [dbo].[Split]
(
@RowData varchar(8000),
@SplitOn nvarchar(5)
)
RETURNS @RtnValue table
(
Id int identity(1,1),
Data varchar(8000)
)
AS
BEGIN
Declare @Cnt int
Set @Cnt = 1
While (Charindex(@SplitOn,@RowData)>0)
Begin
Insert Into @RtnValue (data)
Select Data = ltrim(rtrim(Substring(@RowData,1,Charindex(@SplitOn,@RowData)-1)))
Set @RowData = Substring(@RowData,Charindex(@SplitOn,@RowData)+1,len(@RowData))
Set @Cnt = @Cnt + 1
End
Insert Into @RtnValue (data)
Select Data = ltrim(rtrim(@RowData))
Return
END

---------------------------------------------------------------------------
alter PROCEDURE [dbo].[sp_Product_Info]
@ProductID varchar(MAX)
AS

DECLARE @ProductIDcount int
SELECT @ProductIDcount = COUNT(*) FROM dbo.Split(@ProductID ,',')

DECLARE @Table TABLE( ProductID int, ProductName Varchar(max),[CompantName] Varchar(max));

DECLARE @intFlag INT, @ProdID int, @RowCount int

SET @intFlag = 1
WHILE (@intFlag < = @ProductIDcount)
BEGIN
SELECT @ProdID = data FROM dbo.Split(@ProductID , ',') where Id = @intFlag

select @RowCount = Count(*) FROM [dbo].[Product]
WHERE ProductID = @ProdID

if(@RowCount > 0)
begin
INSERT @Table
SELECT DISTINCT ProductID, [CompantName], ProductName
FROM [dbo].[Product]
WHERE ProductID = @ProdID
End
else
begin
INSERT @Table VALUES (@ProdID, '','')
end
SET @intFlag = @intFlag + 1
END
SELECT * FROM @Table

GO



Thank you.
Attachments
Report.mrt
(19.49 KiB) Downloaded 439 times
Report I am looking For...
Report I am looking For...
RequiredOutput.PNG (40.88 KiB) Viewed 7652 times
Current Output Report...
Current Output Report...
CurrentOutput.PNG (37.13 KiB) Viewed 7652 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: how to set crossheader and crossdataband in page center?

Post by HighAley »

Hello.

You could use next code in the Before Print event of Cross Group Headers:

Code: Select all

if (DS.Rows.Count < 10)
    CrossGroupHeaderBand2.Width += (Page1.Width - Page1.Margins.Left - Page1.Margins.Right - CrossGroupHeaderBand2.Width - CrossDataBand4.Width * DS.Rows.Count)/2;
Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: how to set crossheader and crossdataband in page center?

Post by amitkaushik »

Thanks for reply.
With that crossdataband move in center but CrossGroupHeader are still on left side.

thank you.
Attachments
img.PNG
img.PNG (41.25 KiB) Viewed 7641 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: how to set crossheader and crossdataband in page center?

Post by Alex K. »

Hello,

Please try to set the DockStyle property for the Text components on CrossGroupHeader to Right.

Thank you.
amitkaushik
Posts: 74
Joined: Fri Dec 07, 2012 11:35 am

Re: how to set crossheader and crossdataband in page center?

Post by amitkaushik »

Thank you, its work.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: how to set crossheader and crossdataband in page center?

Post by Alex K. »

Hello,

Great!
Post Reply