mercredi 25 février 2015

Excel open xml sdk - Get an empty cell

I have excel file that I need to locate a cell at.

This cell might have attributes like formatting, data validations rules etc. but no value.

I need to retrieve it even if the cell has (currently) no value since I want to maintain all the cell attributes and only set it a value.

Is it possible?


The code:



public static Cell GetSpreadsheetCell(WorksheetPart worksheetPart, string addressName)
{
return worksheetPart.Worksheet.Descendants<Cell>().
Where(c => c.CellReference == addressName).FirstOrDefault();
}

Aucun commentaire:

Enregistrer un commentaire