This is a migrated thread and some comments may be shown as answers.

Kendo UI .Net Core SpreadSheet with SpreadProcessing library

11 Answers 614 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
NoobMaster
Top achievements
Rank 2
Iron
NoobMaster asked on 13 Feb 2020, 08:07 AM

Hi there.

is there any bridge between SpreadSheet and SpreadProcessing or how can i load XLSX binary from database to that SpreadSheet widget  ??

i have checked this forum but i get gzip verson error.

 

Thanx in advance

Ahmed

11 Answers, 1 is accepted

Sort by
0
NoobMaster
Top achievements
Rank 2
Iron
answered on 13 Feb 2020, 08:09 AM
this is jszip error ==> the constructor with parameters has been removed in jszip 3.0
0
Accepted
Veselin Tsvetanov
Telerik team
answered on 18 Feb 2020, 08:11 AM

Hello Ahmad,

The Telerik.Web.Spreadsheet is yet not available for .Net Core. Therefore, you will need to follow the approach suggested in the following post from the forum thread in question:

https://www.telerik.com/forums/loading-an-excel-file-from-the-server-and-saving-it-to-the-server#AjyuFrDy9EicJRx-hIKxMg

As per the jszip issue, I would suggest you to reference version 2.6.1 of the library. Do you still face the same issue with that release?

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with Telerik UI for ASP.NET Core with the dedicated Virtual Classroom technical training, available to all active customers.
0
NoobMaster
Top achievements
Rank 2
Iron
answered on 19 Feb 2020, 07:23 AM

Hi Veselin .

 

Thanx for your replay.

jszip version  2.6.1 solved my issue ... thank you very much

0
Scott
Top achievements
Rank 1
Veteran
answered on 07 Aug 2020, 02:22 AM

The ability to load a spreadsheet was in the .NET code base. It has been asked for and promised for about 2 years now in the .NET Core code base. Yet, its still missing. In my view, it's not really acceptable to take away functionality and then take years to add it back. It can't be that hard to port it to Core.

To be clear, I am referring to this: https://demos.telerik.com/aspnet-mvc/spreadsheet/server-side-import-export

[HttpPost]
public ActionResult Upload(HttpPostedFileBase file)
{
    var workbook = Workbook.Load(file.InputStream, Path.GetExtension(file.FileName));
                  :    
}
0
Veselin Tsvetanov
Telerik team
answered on 11 Aug 2020, 10:37 AM

Hi Scott,

I have just opened the following feature request in our Feedback portal on your behalf:

https://feedback.telerik.com/aspnet-core-ui/1480010-implement-telerik-web-spreadsheet-for-net-core

Currently, the implementation of the Telerik.Web.Spreadsheet library is available only in .NET MVC. That, however, is needed in .Net Core also, in order to use the Load() and any other Workbook functionality in Core. Having that said, I would recommend you to cast your vote for the above feature request. Based on the interest among the community, we will decide on whether and when to proceed with its implementation.

As a small token of gratitude for bringing that case to our attention, I have updated your Telerik points.

Regards,
Veselin Tsvetanov
Progress Telerik

0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 05 Nov 2020, 09:11 AM

This is really very annoying! No examples on how to load an Excel-File from server-side, no Telerik.Web.Spreadsheet library for .NET Core! It has been promised more than 2(!) years ago. Is it really so hard to port it to .NET Core?

As Scott mentioned it has been part of ASP.NET MVC functionality. I trusted that this functionality was also available in ASP.NET Core. Now I have a big problem because I need exactly this functionality in my ASP.NET Core project. I have to be able to rely on the fact that the new version of a product works like the older one, especially as there was at least two years to deliver this function. Very disappointing!

Regards
Heiko

0
Scott
Top achievements
Rank 1
Veteran
answered on 05 Nov 2020, 01:01 PM

I found this in the 2020.3.195 release: https://docs.telerik.com/devtools/document-processing/libraries/radspreadprocessing/formats-and-conversion/import-and-export-to-excel-file-formats/xlsx/xlsxformatprovider. My issue is I can't figure out how to process it. All the examples are for making a workbook, not reading one. I need to find a column by name and also iterate rows.

Telerik.Windows.Documents.Spreadsheet.Model.Workbook workbook;
IWorkbookFormatProvider formatProvider = new Telerik.Windows.Documents.Spreadsheet.FormatProviders.OpenXml.Xlsx.XlsxFormatProvider();
   
using (Stream input = new FileStream(fileName, FileMode.Open))
{
    workbook = formatProvider.Import(input);
}
0
Veselin Tsvetanov
Telerik team
answered on 09 Nov 2020, 03:53 PM

Hi Scott, 

RadSpreadProcessing depends on the indices of the rows and columns. You can convert between names and indices using the NameConverter class. Following is an example showing how you can import an existing file and iterate all used cells inside column C:

Workbook workbook;
IWorkbookFormatProvider formatProvider = new XlsxFormatProvider();

using (Stream input = new FileStream(fileName, FileMode.Open))
{
    workbook = formatProvider.Import(input);
}

int columnIndex = NameConverter.ConvertColumnNameToIndex("C");

for (int rowIndex = 0; rowIndex < workbook.ActiveWorksheet.UsedCellRange.RowCount; rowIndex++)
{
    CellSelection cell = workbook.ActiveWorksheet.Cells[rowIndex, columnIndex];
}

For more information on how to use the cells and how to obtain the ones used inside the document, please refer to the following topics:

Hi Heiko,

As per porting the Telerik.Web.Spreadsheet to .Net Core, that implementation task competes with the other task in our priority queue. Currently, the votes for that request in our Feedback portal do not demonstrate considerable demand for its implementation. Nevertheless, because of the importance of that feature, we have discussed the task again and we will have that in mind for the upcoming planning loop.

Regards,
Veselin Tsvetanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Scott
Top achievements
Rank 1
Veteran
answered on 09 Nov 2020, 05:16 PM
Thank you for the code snippet and direction. That's what I needed!
0
Heiko
Top achievements
Rank 1
Iron
Veteran
answered on 10 Nov 2020, 07:42 AM

Hi Veselin,

the problem is not the lack of demand. It's like buying a new car, which is the successor to your current car, and you find that the steering wheel is missing.The seller assures you that the engine and rims are brand new. However, you cannot drive the car! I am in a desperate position because I promised my customer a feature that was part of the component in ASP.NET MVC and can no longer be used.

I tried to port the Telerik.Web.Spreadsheet library to .Net Core 2.2 which worked for 95%. The part which is not working is mainly the class "DocumentWorksheetExtensions" where the developer used a property called "PropertyBag" which is not present in the .Net Core implementation of document processing library. Here's an example of the code that is not working:

01.private static void GetCellProperty<T>(DocumentWorksheet worksheet, IPropertyDefinition<T> propertyDefinition, SortedDictionary<int, SortedDictionary<int, Cell>> state)
02.{
03.    var nonDefaultRanges = worksheet.Cells.PropertyBag.GetPropertyValueCollection(propertyDefinition).GetNonDefaultRanges();
04.    var setter = CellSetters[propertyDefinition];
05. 
06.    foreach (var nonDefaultRange in nonDefaultRanges)
07.    {
08.        var cellRange = CellsPropertyBag.ConvertLongCellRangeToCellRange(nonDefaultRange.Start, nonDefaultRange.End);
09. 
10.        SetCellValue(cellRange, worksheet, state, setter, nonDefaultRange.Value);
11.    }
12.}

 

There are other places in the code where e.g. RowPropertyBag is used. Maybe you could ask your developers how to implement these methods without using the PropertyBag property then all problems are solved! I can also make this port available if it works, no problem.

Regards
Heiko

0
Veselin Tsvetanov
Telerik team
answered on 12 Nov 2020, 03:35 PM

Hi Heiko,

I understand your disappointment with the lacking feature in the Telerik UI for ASP.NET Core suite. That is why we are currently discussing the possible timeframe for the Telerik.Web.Spreadsheet implementation for .Net Core. Nevertheless, I still could not give an exact timeframe for that.

As per the PropertyBag issue faced, that is an internal property of the Cells class made available only for the Telerik proprietary assemblies. That is why you could not access it in your project. In order to resolve that issue you would need to use some reflection:

var propertyBag = typeof(Cells).GetProperty("PropertyBag", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(cells, null);

I hope that the above helps. Please, do not hesitate to write back if you have any other questions.

Regards,
Veselin Tsvetanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Spreadsheet
Asked by
NoobMaster
Top achievements
Rank 2
Iron
Answers by
NoobMaster
Top achievements
Rank 2
Iron
Veselin Tsvetanov
Telerik team
Scott
Top achievements
Rank 1
Veteran
Heiko
Top achievements
Rank 1
Iron
Veteran
Share this question
or