I'm using the RadSpreadsheet component and saving it's content following this instructions here:
Telerik RadControls Access the Spreadsheet workbook on the server - Telerik UI for ASP.NET AJAX
So, my code behind is like this:
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsCallback && Request.Params["__CALLBACKID"] == RadSpreadsheet1.UniqueID)
{
Workbook workbook = Telerik.Web.Spreadsheet.Workbook.FromJson(Request.Params["__CALLBACKPARAM"]);
SaveWorkBook(workbook);
}
}
With this code I'm able to save the spreadsheet just fine. But it's not saving the images I add using the Insert Image button (from telerik component). The images are simply not being passed through.
How can I work around that? Thank you!
I love the RadSpreadsheet control. It works great having the toolbar to open files, save files etc.
But I want to run some code on a button press on the page that does some specific validation, then
taking each row and import into a database.
So I use this control to open xls files for user to view, make changes etc.
I then run some custom code that checks (Rows / Columns data) for custom rules
Then I want to take the end result and import that into a database.
Should I be using a Grid Control to do this as it seems impossible to get the worksheet from the RadSpreadSheet control when we use the open toolbar.
I need to import a spreadsheet into a dataset. The spreadsheets have rows and columns of data, but some of the columns are totaled at the bottom. I think this is giving me error when trying to use the DataTableFormatProvider.Export.
So I want to open the file and read the cells row by row. Are there any examples on how to open a spreadsheet and walk through it row by row?
Does the functionality exist to format a range of cells as a table like can be done in Excel?
I use the data provider to read the format of an existing Excel file.
But, a range of cells formatted as a table is not copied into the RadSpreadsheet.
Is there a purpose of the Save Icon on the Home tab toolbar?
I would like to capture some kind of event when a user clicks this icon to direct it to my SaveWorkbook method override in my custom provider.
But, I don't see any such method implemented that can override.
If no ability exists to do this, why then is the icon even there?
Hi,
Is there a way to choose BackgroundColor of cells in RadSpreadsheet from UI that are not part of the given list of colors???
or maybe a way to edit the background color # from UI ???
thanks,
Efrat
Is there a way to create different CustomContextMenu items based on the specific column the cell resides?
I.e. the cells of two different columns will have different and unique ContextMenu item lists.
I'd like to dynamically increase the grid size (add rows and or columns) when a user attempts to paste data that exceeds the default size.
Is there an event that I can capture that fires before the 'Cannot paste, because the copy area and the paste area are not the same size and shape' error occurs?
I've tried OnClientChanging and OnClientPaste but the error is thrown before either of these events fire.
Hi, i try to export data table to excel file using following code https://docs.telerik.com/devtools/aspnet-ajax/knowledge-base/common-export-large-amount-of-data-to-pdf-xlsx-and-csv-using-the-telerik-document-processing-libraries?_ga=2.266990472.785509911.1678626449-162692405.1645090225&_gl=1*1ns64vr*_ga*MTYyNjkyNDA1LjE2NDUwOTAyMjU.*_ga_9JSNBCSF54*MTY3ODY3Nzk2OS4xMTguMS4xNjc4Njc4MzQwLjM1LjAuMA.. , in data table we have number columns which is not export correct format ,we need to change format for apply formulas, we need to avoid this, bcz each time need to change that format in order to sum the column,
Private Sub SpreadStreamProcessingForXLSXAndCSV(ByVal dt As DataTable, ByVal filename As String, ByVal Optional docFormat As SpreadDocumentFormat = SpreadDocumentFormat.Xlsx, ByVal Optional sheetName As String = "Sheet1") If dt Is Nothing Then Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page) manager.Alert("No records to export to excel!") Exit Sub End If Using stream As MemoryStream = New MemoryStream() Using workbook As IWorkbookExporter = SpreadExporter.CreateWorkbookExporter(docFormat, stream) Using worksheetExporter As IWorksheetExporter = workbook.CreateWorksheetExporter(sheetName) For i As Integer = 0 To dt.Columns.Count - 1 Using columnExporter As IColumnExporter = worksheetExporter.CreateColumnExporter() columnExporter.SetWidthInPixels(100) End Using Next ExportHeaderRows(worksheetExporter, dt) For Each row As DataRow In dt.Rows Using rowExporter As IRowExporter = worksheetExporter.CreateRowExporter() For Each item In row.ItemArray Dim normalFormat As SpreadCellFormat = New SpreadCellFormat() normalFormat.FontSize = 10 normalFormat.VerticalAlignment = SpreadVerticalAlignment.Center normalFormat.HorizontalAlignment = SpreadHorizontalAlignment.Center Using cellExporter As ICellExporter = rowExporter.CreateCellExporter() cellExporter.SetValue(item.ToString()) cellExporter.SetFormat(normalFormat) End Using Next End Using Next End Using End Using Dim output As Byte() = stream.ToArray() If docFormat = SpreadDocumentFormat.Csv Then FileExtension = "csv" filename = filename ContentType = "text/csv" ElseIf docFormat = SpreadDocumentFormat.Xlsx Then FileExtension = "xlsx" filename = filename ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" End If WriteFileToResponse(output, filename) End Using End Sub Private Sub ExportHeaderRows(ByVal worksheetExporter As IWorksheetExporter, ByVal dt As DataTable) Using rowExporter As IRowExporter = worksheetExporter.CreateRowExporter() Dim HeaderRowHeight As Double = 50 rowExporter.SetHeightInPoints(HeaderRowHeight) Dim format As SpreadCellFormat = New SpreadCellFormat() format.IsBold = True format.Fill = SpreadPatternFill.CreateSolidFill(New SpreadColor(142, 196, 65)) format.ForeColor = New SpreadThemableColor(New SpreadColor(255, 255, 255)) format.HorizontalAlignment = SpreadHorizontalAlignment.Center format.VerticalAlignment = SpreadVerticalAlignment.Center For i As Integer = 0 To dt.Columns.Count - 1 Using cellExporter As ICellExporter = rowExporter.CreateCellExporter() cellExporter.SetFormat(format) cellExporter.SetValue(dt.Columns(i).ColumnName) End Using Next End Using End Sub Private Sub WriteFileToResponse(ByVal content As Byte(), ByVal strfilename As String) Response.ContentType = ContentType Response.Headers.Remove("Content-Disposition") Response.AppendHeader("Content-Disposition", String.Format("attachment; filename={0}.{1}", strfilename, FileExtension)) Response.BinaryWrite(content) Response.[End]() End Sub