Add header to each pages when Export Telerik RadGridView to a Workbook (ExportToWorkBook) in WPF

0 Answers 58 Views
GridView
Monica
Top achievements
Rank 1
Monica asked on 24 Nov 2022, 10:27 AM

Hello,

In our application, we need to add header to each pages when exporting the grid(RadGridView) into the workbook using ExportToWorkBook
I tried to use the option mentioned in "https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/features/headers-and-footers#headerfootersection" to fix this, but it is not work as expected.

Please see the attached image of our requirement and provide information on how to achieve this ?

Thanks in advance.



Monica
Top achievements
Rank 1
commented on 09 Dec 2022, 04:55 AM

Telerik Team,

Is there any lead for this issue ?

When I checked the document I have noticed the PrintTitles option which matches my requirement, To achieve this I tried to update my telerik dlls from this version https://www.telerik.com/support/whats-new/wpf/release-history/ui-for-wpf-r3-2022-sp1 .

But I got the following error

"Exception: Cannot find resource named 'Telerik.Windows.Controls.RadProgressBar'. Resource names are case sensitive."

Martin Ivanov
Telerik team
commented on 13 Dec 2022, 12:28 PM

This error usually means that something is messed up with the Telerik dlls or the used Styles. I would recommend you to double check if all referenced Telerik dlls have the same version. Also, if you merge any Telerik .xaml files, ensure that they are of the same version like the dlls. Then clean and rebuild the project. If this doesn't help, I suggest you to send over a sample project showing the issue.
Monica
Top achievements
Rank 1
commented on 29 Dec 2022, 02:19 PM | edited

Hello Martin,

Eventhough I have updated all the dll I encounter the following error, do you have any idea about this ?

System.TypeLoadException: 'Could not load type 'Telerik.Windows.Documents.Spreadsheet.Layout.Layers.ColorScaleRenderable' from assembly 'Telerik.Windows.Documents.Spreadsheet, Version=2022.3.1108.40, Culture=neutral, PublicKeyToken=5803cfa389c90ce7'.'

If possible could you tell me which release will support the PrintTitles options or can you share the dll files for this?

 

Martin Ivanov
Telerik team
commented on 30 Dec 2022, 11:08 AM

The PrintTiles option is available since R3 2022 SP1. This is the same version as the dlls you are using. Or at least it seems so from the posted error. However, the error is too generic to tell what exactly is causing it. In order to tell you more about this I will need to check the troublesome project. Can you send it over? If you are concerned with privacy, I would suggest you to share the project over the ticketing system (by opening a new support ticket) through your telerik.com account.
Monica
Top achievements
Rank 1
commented on 30 Dec 2022, 11:56 AM | edited

Thank you Martin, For now I will create sample solution with above error and share it to you.

Meanwhile is it possible for you to share the sample project in which PrintTitles option is implemented ? It will be helpful for me.

Martin Ivanov
Telerik team
commented on 03 Jan 2023, 12:46 PM

I've attached a small project showing this. The project is actually the PrintPreviewWithSpreadsheet SDK example, but with a slight modification in the CreateSpreadsheet() method.

private static RadSpreadsheet CreateSpreadsheet(RadGridView grid)
{
	Workbook workbook = CreateWorkBook(grid);
	
	WorksheetPageSetup pageSetup = workbook.ActiveWorksheet.WorksheetPageSetup;
	pageSetup.PrintTitles.RepeatedRows = new RowRange(0, 1);
	pageSetup.PrintTitles.RepeatedColumns = new ColumnRange(0, 1);

	return new RadSpreadsheet()
	{
		Workbook = workbook
	};
}

Monica
Top achievements
Rank 1
commented on 04 Jan 2023, 03:44 AM

Thank you Martin, I will use this

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Monica
Top achievements
Rank 1
Share this question
or