document.WorkbookPart.Workbook.CalculationProperties.ForceFullCalculation = true;
document.WorkbookPart.Workbook.CalculationProperties.FullCalculationOnLoad = true;
string filename = Server.MapPath("/") + "ExcelData.xlsx";
using (SpreadsheetDocument document = SpreadsheetDocument.Open(filename, true))
{
document.WorkbookPart.Workbook.CalculationProperties.ForceFullCalculation = true;
document.WorkbookPart.Workbook.CalculationProperties.FullCalculationOnLoad = true;
Sheet sheet = document.WorkbookPart.Workbook.Descendants<Sheet>().SingleOrDefault(s => s.Name == "myRange1");
if (sheet == null)
{
throw new ArgumentException(
String.Format("No sheet named {0} found in spreadsheet {1}", "myRange1", filename), "sheetName");
}
WorksheetPart worksheetPart = (WorksheetPart)document.WorkbookPart.GetPartById(sheet.Id);
int rowIndex = int.Parse("C4".Substring(1));
Row row = worksheetPart.Worksheet.GetFirstChild<SheetData>().
Elements<Row>().FirstOrDefault(r => r.RowIndex == rowIndex);
Cell cell = row.Elements<Cell>().FirstOrDefault(c => "C4".Equals(c.CellReference.Value));
}
:
사용 CellFormula (< F>) 요소는 화학식 문자를 정의한다. 수식 에는 광범위한 사전 정의 함수가 포함 된 수학식이 포함될 수 있습니다. CellValue (< v>) 요소는 마지막으로 계산 된 시간을 기반으로 캐시 된 수식 값을 저장합니다.
다음 라인을 추가하여 직접 알아 냈습니다. Convert.ToDouble (cell.CellValue.InnerText); 그러나 나는 당신에게 나에게 응답하는 어떤 방법으로도 신용을 줄 것이다. 감사 –