private void LoadFile(string FileName) { Xls.Open(FileName); ActualValue = 0; ValueRange = Xls.GetNamedRange("Value", 0); if (ValueRange == null) { throw new Exception("There is no range named \"value\" in the template"); } MinValue = ReadDoubleName("Minimum"); MaxValue = ReadDoubleName("Maximum"); StepValue = ReadDoubleName("Step"); ChartIndex = -1; for (int i = 1; i <= Xls.ObjectCount; i++) { string ObjName = Xls.GetObjectName(i); if (String.Compare(ObjName, "DataChart", true) == 0) { ChartIndex = i; break; } } if (ChartIndex < 0) { throw new Exception("There is no object named \"DataChart\" in the template"); } ChartProps = Xls.GetObjectProperties(ChartIndex, true); }