def YTD_Book(self, filename, *params): """Create a new workbook with PNL Commercial Summary table""" params = iter(params) out = params.next() for p in params: out = self.Merge_Dictionaries(out, p) # Open the new file in the same instance for speed self.remove_file(filename) # Don't try opeing in exsting instance if the file does not exist, you get a com_error self.OutputFileHandle = Excel(BookVisible=0, Visible=1, filename=filename) # newinstance=1 xlSheetSrc = Sheet(self.OutputFileHandle) xlSheetSrc.renameSheet(self.OutputFileName) #template = Template(r"C:\Users\sdo\Documents\Research and Learning\Git Repos\SAIDI-SAIFI-Calculator\Data\Templates.xlsx") template = Template( os.path.expanduser( '~/Documents/SAIDI and SAIFI/Templates/Templates.xlsx')) template.Place_Template("Commercial", xlSheetSrc._getCell(self.OutputFileName, 1, 1)) template.Set_Values(out) template.Auto_Fit() # Handles the closing of the template file self.OutputFileHandle.save(filename) self.OutputFileHandle.closeWorkbook()
def __init__(self, ORSCalculatorInstance, xlInstance): self.ORS = ORSCalculatorInstance self.xlInst = xlInstance self.Sheet = Sheet(self.xlInst) self.InputSheet = "Input" self.CalculationSheet = "Calculation" self.StatsSheet = "Statistics" self.Graphs = XlGraphs(xlInstance, self.Sheet) self.srcRowOffset = 2 # The number of rows taken up by headings (before the data begins) self.srcColumnOffset = 1 # The number of columns that the data is offset by # Set the order of the headings and data in the sheet self.NetworkHeadings = ["ELIN", "OTPO", "TPCO"] self.IndexHeadings = ["SAIDI", "SAIFI"] self.DateOrigin = pos( row=4, col=1) # The postion to place the fist date on the Excel sheet # Graph offsets and dimentions self.ChartDimentions = pos(x=700, y=480) self.ChartOrigins = [] x = 85 y = 100 for network in self.NetworkHeadings: self.ChartOrigins.append(pos(x=x, y=y)) x += self.ChartDimentions.x # Shift the charts for the next network to the right
def __init__(self, ORSCalculatorInstance, xlInstance): self.ORS = ORSCalculatorInstance #self.xlInst = xlInstance self.Sheet = Sheet(xlInstance) self.InputSheet = "Input" self.CalculationSheet = "Calculation" self.StatsSheet = "Statistics" self.NetworkName = self.ORS.networknames[0] self.DateOrigin = pos(row=4, col=1) # The postion to place the fist date
def __init__(self, xlInstance): self.xlInst = xlInstance self.Sheet = Sheet(xlInstance) # Create some dictionaries to hold customer numbers self.Customer_Nums = {} for name in self.NetworkNames: self.Customer_Nums[name] = {} # Create a ordered list of network charts/tables to display self.StartDates = []
def __init__(self, xlInstance): self.Sheet = Sheet(xlInstance)