|116970||Jul 11,2014 05:41 PM UTC||Jul 16,2014 05:32 PM UTC||ASP.NET Web Forms (Classic)||3|
Thank you for using Syncfusion products.
XlsIO does not support to get all the text in worksheet as a string. Whereas you can achieve this through a workaround. We have created a sample that illustrate how to get all the text in worksheet as string. It can be downloaded from the following link.
Sample Link: GetText.zip
Kindly refer to this and let us know if you need any clarification.
In the given sample, we have accessed the GetAllText method to return all texts in worksheet as string. We have shared the code snippets for your reference. Kindly try this and let us know if this helps.
//Step 1 : Instantiate the spreadsheet creation engine.
ExcelEngine excelEngine = new ExcelEngine();
//Step 2 : Instantiate the excel application object.
IApplication application = excelEngine.Excel;
string fileName = Server.MapPath("App_data/BussinessObject.xlsx");
IWorkbook workbook = application.Workbooks.Open(fileName, ExcelOpenType.Automatic);
//IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet sheet = workbook.Worksheets;
string text = sheet.GetAllText();
workbook.Version = ExcelVersion.Excel2010;
workbook.SaveAs("Output.xlsx", ExcelSaveType.SaveAsXLS, Response, ExcelDownloadType.PromptDialog);
public static class Extension
public static string GetAllText(this IWorksheet sheet)
int lastRow = sheet.UsedRange.LastRow;
int lastColumn = sheet.UsedRange.LastColumn;
StringBuilder builder = new StringBuilder();
IMigrantRange range = sheet.MigrantRange;
for (int iRow = 1; iRow <= lastRow; iRow++)
for (int iColumn = 1; iColumn <= lastColumn; iColumn++)
Please let us know if you need any clarification.
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.
or the page will be automatically redirected to sign-in page in 10 seconds.