Telerik Forums
UI for ASP.NET Core Forum
1 answer
27 views
i have sample application. when export to excel using ToXlsxStream date field show as number value instead of date . 
Ivaylo
Telerik team
 answered on 12 May 2025
1 answer
37 views
Hi Team,

I am facing an issue where formulas in the spreadsheet are not properly reflecting when importing or downloading sheets in my application. Specifically, the formulas are not retained during the upload process or included correctly during the export/download operation.

Below are the reference codes for upload and download functionality:

Upload Code:
using (var package = new ExcelPackage(stream))
{
    var workbook = package.Workbook;
    var worksheet = workbook.Worksheets[0];

    var rows = new List<dynamic>();
    for (int row = 1; row <= worksheet.Dimension.End.Row; row++)
    {
        var rowData = new List<string>();
        for (int col = 1; col <= worksheet.Dimension.End.Column; col++)
        {
            rowData.Add(worksheet.Cells[row, col].Text);
        }
        rows.Add(new { cells = rowData.Select(val => new { value = val }).ToArray() });
    }

    var sheetData = new
    {
        name = worksheet.Name,
        rows = rows.ToArray()
    };

    return Json(new { success = true, data = sheetData });
}



Download Code:
using (var package = new ExcelPackage())
{
    var sheet = spreadsheetData.sheets.FirstOrDefault();
    if (sheet != null)
    {
        var worksheet = package.Workbook.Worksheets.Add(sheet.name);

        foreach (var row in sheet.rows)
        {
            foreach (var cell in row.cells)
            {
                var excelCell = worksheet.Cells[row.index + 1, cell.index + 1];

                // Set font properties
                excelCell.Style.Font.Size = cell.fontSize > 0 ? cell.fontSize : sheet.defaultCellStyle.fontSize;
                excelCell.Style.Font.Bold = cell.bold;

                // Set background color
                if (!string.IsNullOrEmpty(cell.background))
                {
                    excelCell.Style.Fill.PatternType = ExcelFillStyle.Solid;
                    excelCell.Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml(cell.background));
                }

                // Set font color
                if (!string.IsNullOrEmpty(cell.color))
                {
                    excelCell.Style.Font.Color.SetColor(ColorTranslator.FromHtml(cell.color));
                }

                // Set text alignment
                excelCell.Style.HorizontalAlignment = cell.textAlign switch
                {
                    "center" => ExcelHorizontalAlignment.Center,
                    "right" => ExcelHorizontalAlignment.Right,
                    _ => ExcelHorizontalAlignment.Left,
                };

                // Set number format
                if (!string.IsNullOrEmpty(cell.format))
                {
                    excelCell.Style.Numberformat.Format = cell.format;
                }

                // Set formula if available
                excelCell.Formula = cell.formula;
                
                // Set cell value
                excelCell.Value = cell.value;
            }
        }
    }

    fileStream = new MemoryStream(package.GetAsByteArray());
}


Could you please guide me on resolving this issue to ensure formulas are preserved and processed accurately?

Thank you for your assistance!
Anton Mironov
Telerik team
 answered on 14 Jan 2025
1 answer
81 views

Hello. i m wishing to use in future telerik ui for asp.net core for my projects.


 I use Telerik.UI.for.AspNet.Core and Telerik.Web.Spreadsheet packages for VS 2022.

Right now i'm testing in demo version realization of formulas. I made my formulas, it works good, makes the result that i want

But looks like it recalculates formula in ANY change on the sheet.  .
Its a big optimization problem cause i need a big sheet with thousands cells with this formula
Any way to avoid it?

I need to recalculate formulas only if depended cells were changed just like base formulas works, but i don't see in documentation any way to make it

Looks like whole telerik formulas works like that. any change makes rerender of sheet and recalculation of any formulas

 

Alexander
Telerik team
 answered on 23 Jul 2024
1 answer
106 views

Hello,

It is not clear from your documentation whether you are still relying on jszip.js for Excel exports.  We have found that this library has critical security vulnerabilities that have not been addressed by the FOSS developer who created it.

Please advise as to what you recommend.

 

Thanks.

Mihaela
Telerik team
 answered on 29 Apr 2024
1 answer
137 views

Hi There, 

I'm working on a web app and need to access the Excel column with letters instead of an index. I have gone through the documentation but didn't find how we can access the Excel column with alphabets such as A20

Could you please let me know if you have any functions or not?

 

Thanks,

 

Stoyan
Telerik team
 answered on 07 Jun 2023
0 answers
217 views

Hello guys,

is it possible to define a conditional formatting on a whole column? E.g. if you want to set the background of a cell to yellow if the value is greater than 0 (see screenshot, column 'Fehlend').

In my case it's even more difficult because my whole datasource is coming from the server.

@(Html.Kendo().Spreadsheet()
	.Name("bestandsliste")
	.Columns(3)
	.HtmlAttributes(new { style = "width:100%" })
	.Sheets(x =>
	{
		x.Add()
			.Name("Bestandsliste")
			.Columns(y =>
			{
				y.Add().Width(400);
				y.Add().Width(120);
				y.Add().Width(120);
				y.Add().Width(120);
			})
			.DataSource<Fahnenbestand>(y => y
				.Custom()
				.Sort(z => z.Add(a => a.Fahnenkategorie))
				.Transport(z => z.Read("spreadsheet_onRead"))
			)
			.FrozenRows(1)
			.Rows(y =>
			{
				y.Add().Height(30).Cells(z =>
				{
					z.Add().FontSize(20).TextAlign(SpreadsheetTextAlign.Center);
					z.Add().FontSize(20).TextAlign(SpreadsheetTextAlign.Center);
					z.Add().FontSize(20).TextAlign(SpreadsheetTextAlign.Center);
					z.Add().FontSize(20).TextAlign(SpreadsheetTextAlign.Center);
				});
			});
	})
	.Sheetsbar(false)
	.Toolbar(false)
)

function spreadsheet_onRead(options) {
	$.ajax({
		url: `@ViewData[ViewDataVariables.UrlWebApi]/FlagCategory/GetOverviewAllFlagsAsSpreadsheet`,
		headers: { 'Authorization': '@token' },
		success: function (result) {
			var sheet = kendoSpreadSheetBestandsliste.activeSheet();
			sheet.resize(result.Total + 5, 3);

			options.success(result.Data);
		},
		error: function (result) {
			options.error(result);
		}
	});
}

I already check the css of the cells. Indeed I can simply set the background color of the cells of a specific column by a condition via jquery (like "if value greater 0, set background yellow"), but the cells carry very little informations. It's not possible to prove if the cell I'm currently looking is belonging to correct column. It would be easy if there would be an attribute like aria-labeledby="COLUMNHEADERCELL" but that's not the case.

<div class="k-spreadsheet-cell" style="[..]"><div class="k-vertical-align-bottom">1</div></div>

Maybe there is a solution to get all cells of one column via the api of my spreadsheet object? Looking forward to hearing from you.

Best regards,

Daniel

Daniel
Top achievements
Rank 3
Iron
Iron
Iron
 updated question on 29 Mar 2023
0 answers
115 views

Hey guys,

I'm currently working newly with the kendo spreadsheet. Default amount of rows is 200 and I can define it programatically, I know.

My spreadsheet has a datasource. Is there a smart solution to handle the count of rows by it's datasource? So if the datasource has 400 elements, that my spreadsheet increase the rows?

Best Regards,
Daniel

@(Html.Kendo().Spreadsheet()
	.Name("bestandsliste")
	.HtmlAttributes(new { style = "width:100%" })
	.Sheets(x =>
	{
		x.Add()
			.Name("Bestandsliste")
			.DataSource<Fahnenbestand>(y => y
				.Custom()
				.Transport(z => z.Read("spreadsheet_onRead"))
			);
	})
	.Sheetsbar(false)
	.Toolbar(false)
)

function spreadsheet_onRead(options) {
	$.ajax({
		url: `@ViewData[ViewDataVariables.UrlWebApi]/FlagCategory/GetOverviewAllFlagsAsSpreadsheet`,
		headers: { 'Authorization': '@token' },
		success: function (result) {
			console.log(options);
			console.log(options.rows);
			options.success(result.Data);
		},
		error: function (result) {
			options.error(result);
		}
	});
}



 

Daniel
Top achievements
Rank 3
Iron
Iron
Iron
 asked on 27 Mar 2023
1 answer
130 views
I try to upload a 15MB xlsx file but it seems to crash/freeze my browser.
Alexander
Telerik team
 answered on 13 Mar 2023
1 answer
92 views

Navigation imporvemtns to speedsheet.

 

Is it possible to only move between "open cells for input. " With fx. using tab or enter. 

When you are input finance data. It would be nice, that with a tab, it only moves between open cell. Is this possible. 

reg. jakob

 

link to speecsheet navigation

Mihaela
Telerik team
 answered on 03 Feb 2023
1 answer
104 views

Hi all, 

I'm trying to understand if it is possible to create a Spreadsheet with the RadSpreadProcessing library and work with it in a web environment. I saw from older posts that there was a Telerik.Web.Spreadsheet library that supported this integration, but it seems that it is not directly supported now with .NET 6.

I need to show a spreadsheet to the user on a browser, with support for formulas, macros, excel graphs, workbook/worksheet protection, autofit of columns, basically everything that can be done with excel. From the documentation it seems that many of the features that I need are not supported by Telerik UI Web, but are supported by the RadSpreadProcessing. Is it correct? Is there a way to implement all this with the Web UI libraries?

Thank you everyone in advance!

Tommaso

Aleksandar
Telerik team
 answered on 25 Oct 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?