Need a way to set a default value for all cells in a column. I thougt about creating a named range. But it doesn't provide a method to set the value for the cells in a range.
I have used SetSharedFormula method. But when I save the excel as tab delimeted, the value for the cell is not being written out.
Thanks
This message was posted using Aspose.Live 2 Forum
Hi,
Well, you may set a default data/value for all the cells in a range. See the sample code below to achieve your task. You may modify my code segment accordingly too.
Sample code:
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
//Specify your given range
Range range = worksheet.Cells.CreateRange(“B10:C100”);
for (int i = range.FirstRow; i < range.RowCount + range.FirstRow; i++)
{
for (int j = range.FirstColumn; j < range.ColumnCount + range.FirstColumn; j++)
{
//Set the default value
worksheet.Cells[i, j].PutValue(“test”);
}
}
workbook.Save(“e:\test2\outBook.xls”);
Thank you.
Hi,
This issue has been logged as a New Feature Request with id: CELLSNET-25261.
Hi,
Please try the new fix Aspose.Cells for .NET v5.3.1.1. We have added Range.Value property.
It only supports simple values or a two-dimension Array object data.
e.g.
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
Range range = worksheet.Cells.CreateRange(“B10:C100”);
range.Value = “test”;
workbook.Save(“e:\test2\my_outrangvalues.xls”);
Thanks.