We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to print a spreadsheet

Thread ID:

Created:

Updated:

Platform:

Replies:

142459 Feb 5,2019 10:53 AM UTC Feb 12,2019 11:30 AM UTC UWP 5
loading
Tags: SfSpreadsheet
Christian
Asked On February 5, 2019 10:53 AM UTC

Hi,

How can I print a spreadsheet in Windows UWP?

Best
Christian


Arulraj A [Syncfusion]
Replied On February 5, 2019 01:03 PM UTC

Hi Christian, 

Thank you for requesting this feature. This feature is already existing in our database and here’s the link to the feature request page 

If the definition of this feature corresponds to your requirement, please vote and comment. We will prioritize the features every release based on the demands. 

Regards,  
Arulraj A 


Christian
Replied On February 6, 2019 11:25 AM UTC

Is there a recommendation on how to go about printing Excel until the new feature is available?

Mohanraj Gunasekaran [Syncfusion]
Replied On February 7, 2019 01:46 PM UTC

Hi Christian, 
 
Thanks for your update. 
 
As per our previous update, currently there is no in-built support to print the SfSpreadsheet. But, you can achieve this by exporting the SfSpreadsheet to pdf using PdfPage and PdfGrid then load that pdf file in PdfViewrCotrol to print the SfSpreadsheet those are available in “Syncfusion.PdfViewer.UWP.dll”. Please refer the following code example,  
  
Code example  
Xaml  
xmlns:pdfviewer="using:Syncfusion.Windows.PdfViewer"  
  
<pdfviewer:SfPdfViewerControl x:Name="pdfviewer"/>  
 
C# 
//Create a new PDF document. 
 
PdfDocument pdfDocument = new PdfDocument(); 
StorageFile storageFile = null; 
 
foreach (var sheet in this.spreadsheet.Workbook.Worksheets) 
{ 
    //Create the page 
    PdfPage pdfPage = pdfDocument.Pages.Add(); 
 
    //Create the parent grid 
 
    PdfGrid parentPdfGrid = new PdfGrid(); 
 
    //Add the rows 
    for (int i = 0; i < this.spreadsheet.ActiveSheet.UsedRange.Row; i++) 
    { 
        PdfGridRow row1 = parentPdfGrid.Rows.Add(); 
        row1.Height = 50; 
        parentPdfGrid.Columns.Add(this.spreadsheet.ActiveSheet.UsedRange.Column); 
        for (int j = 0; j < this.spreadsheet.ActiveSheet.UsedRange.Column; j++) 
        { 
            var style = this.spreadsheet.ActiveSheet.UsedRange[i, j]; 
            PdfGridCell pdfGridCell = parentPdfGrid.Rows[i].Cells[j]; 
            pdfGridCell.Value = style.Value; 
 
        } 
    } 
 
    //Draw the PdfGrid. 
    parentPdfGrid.Draw(pdfPage, PointF.Empty); 
    StorageFolder local = Windows.Storage.ApplicationData.Current.LocalFolder; 
    storageFile = await local.CreateFileAsync("Sample.pdf", CreationCollisionOption.ReplaceExisting); 
    //Save the document. 
    await pdfDocument.SaveAsync(storageFile); 
} 
if (storageFile != null) 
{ 
    FileStream stream = File.OpenRead(storageFile.Path); 
    pdfViewer.Unload(); 
    pdfViewer.LoadDocument(stream); 
    //Print the pdf file.  
    pdfViewer.Print(); 
    pdfDocument.Dispose(); 
} 
 
 
Please get back us if you need any further assistance on this. 
 
Regards, 
Mohanraj G 


Christian
Replied On February 11, 2019 12:41 PM UTC

Thank you.
I cannot get that demo to work. I changed the syncfusion references to nuget packages, I obviously we do not have the same folder structure.
The demo starts (very slow). Eventually I can see a grid with numbers, but the app is forzen.

Attachment: SpreadsheetDemo_4e508921.zip

Subburaj Pandian Veluchamy [Syncfusion]
Replied On February 12, 2019 11:30 AM UTC

Hi Christian, 
  
Thank you for the update. 
  
By default, SfSpreadsheet control does not have the support to print the cells. So, we have tried to load the cell values in PdfGrid and load that PdfGrid in PdfDocument. Then, we have used the PdfViewer control used to load and print that pdfDocument. So, obviously those operations will take this much of time to print the SfSpreadsheet. This is our current support to print the SfSpreadsheet control. 
  
Please get back us, if you have any query on this. 
 
Regards,
Subburaj Pandian V  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;