예제 #1
0
 def __init__(self,
              wsheet=None,
              dpath=None,
              namefile=None,
              dicrowconf=None,
              wbnsct=None,
              pathconf=None):
     self.dicrowconf = dicrowconf
     self.dpath = dpath
     self.wsheet = wsheet
     self.namefile = namefile
     #max colum ws1
     self.mcol = self.wsheet.api.UsedRange.Columns.count
     #max row ws1
     self.mrow = self.wsheet.api.UsedRange.Rows.count
     self.dirpathconf = getdirpath(pathconf)
     self.__hm_rangege = (self.dicrowconf["hm_rangege"])
     self.numberhm = int(sepnumberandstrfromstr(self.__hm_rangege)[1])
     self.__wb1 = wbnsct
     listsheetnamehm = (self.dicrowconf["listsheetnamehm"])
     # return csv have list sheet name
     self.pathlsn = refullpath(dirpath=self.dirpathconf,
                               filename=listsheetnamehm)
     try:
         self.lsheet = convertcsvto1list(path=self.pathlsn)
     except:
         pass
예제 #2
0
    def __init__(self, pathconf=None):
        self.__pathconf = pathconf
        dictconf = returndictrowforcsv(path=pathconf)
        self.__hm_congtac = dictconf["hm_congtac"]
        self.__hm_bombt = dictconf["hm_bombt"]
        self.__hm_macmtc = dictconf["hm_macmtc"]
        self.__hm_materiasvattu = dictconf["hm_materiasvattu"]
        self.__hm_vlvk = dictconf["hm_vlvk"]
        self.__hm_VLTP = dictconf["hm_vltp"]
        self.__hm_MNCTP = dictconf["hm_mnctp"]

        self.__hm_VTKCT = dictconf["hm_vtkct"]
        self.__hm_NCKCT = dictconf["hm_nckct"]

        self.__hm_startpasterange = dictconf["hm_startpasterange"]
        sign_vk = dictconf["sign_vk"].replace(":", ",")
        self.sign_vk = returnlist_from_listinstr(sign_vk)
        sign_BT = dictconf["sign_bt"].replace(":", ",")
        self.sign_BT = returnlist_from_listinstr(sign_BT)
        self.__startpasterange = returnseplistintbbystr(
            self.__hm_startpasterange)

        self.pathlsn = refullpath(dirpath=getdirpath(pathconf),
                                  filename=dictconf["listsheetnamehm"])
        fct = dictconf["fct"]
        try:
            self.lsheetname = convertcsvto1list(path=self.pathlsn)
        except:
            pass
        fname = dictconf["khns_namfile"]
        if fct.strip() == "all":
            self.wb = activeworkbook(namefile=fname, checknamefile=True)
            for sheet in self.lsheetname:
                print(sheet)
                self.wb.sheets[sheet].activate()
                self.__sheetdesactive = activesheet()
                self.m_row = self.__sheetdesactive.range(
                    self.__hm_congtac +
                    str(self.__sheetdesactive.cells.last_cell.row)).end(
                        'up').row
                self.__hdata()
                #self.copyrangfromconf()
        else:
            self.__sheetdesactive = activesheet()
            #self.copyrangfromconf()
            self.m_row = self.__sheetdesactive.range(
                self.__hm_congtac +
                str(self.__sheetdesactive.cells.last_cell.row)).end('up').row
            self.__hdata()
예제 #3
0
 def copyrangfromconf(self):
     # return csv have list sheet name
     try:
         self.lsheetname = convertcsvto1list(path=self.pathlsn)
     except:
         pass
     if self.copyhm.strip() == "all":
         self.wb = activeworkbook(namefile=self.fname, checknamefile=True)
         for sheet in self.lsheetname:
             self.wb.sheets[sheet].activate()
             self.__sheetdesactive = activesheet()
             self.__copyrangfromconfk()
     else:
         self.__sheetdesactive = activesheet()
         self.__copyrangfromconfk()
예제 #4
0
from pynvn.excel.copypasteexell import cprange
import xlwings as xw
from pynvn.csv.rcsv import returndictrowforcsv
from pynvn.string.slist import returnseplistintbbystr
from pynvn.excel import activesheet,activeworkbook
from pynvn.csv.tolist import convertcsvto1list
from pynvn.path.ppath import refullpath,getdirpath
def conf_csvtolist (pathconf,path_csvtoconverttolist)
    """ copy sheet and change value cell """
    # call dict 
    dictconf = returndictrowforcsv(path=pathconf)
    # return csv have list sheet name 
    self.pathlsn = refullpath(dirpath=self.dirpathconf,
                                        filename=listsheetnamehm)
    copyhm = dictconf["copyhm"]
    try:                        
        self.lsheetname = convertcsvto1list(path=path_csvtoconverttolist)
    except:
        pass
예제 #5
0
    def __init__ (self, fpath = None,
                        pathconf = None,
                        pathconfigexcelcopy = None
                        ):
        self.pathconf = pathconf
        self.pathconfigexcelcopy = pathconfigexcelcopy
        self.dicrowconf = returndictrowforcsv(path=pathconf)
        self.__fpath = fpath
        dirparhconf = parentdirectory(pathconf)
        self.__sheetnametor=self.dicrowconf["khns_sheetnamekhns"]
        self.__namefile=self.dicrowconf["khns_namfile"]
        self.__rangeg =self.dicrowconf["hm_rangege"]

        self.__rangeintct = returnseplistintbbystr(self.__rangeg)

        self.__rangestrct = returnliststr_from_str(self.__rangeg)

        self.__mvta = (self.dicrowconf["khns_mavatu"])
        self.__mvt = col2num (self.__mvta)
        self.__khns_ndcva = (self.dicrowconf["khns_noidungcongviec"])
        self.__khns_ndcv = col2num (self.__khns_ndcva)
        self.__khns_dvta = (self.dicrowconf["khns_dvt"])
        self.__khns_dvt = col2num (self.__khns_dvta)

        self.__khns_muchaophi = (self.dicrowconf["khns_muchaophi"])

        self.__khns_muchaophi_int = col2num(self.__khns_muchaophi)

        self.__hm_mvt = int(self.dicrowconf["hm_mvt"])
        self.__hm_ndcv = int(self.dicrowconf["hm_noidungcongviec"])
        self.__hm_dvt = int(self.dicrowconf["hm_dvt"])

        self.__hm_dgth_str = (self.dicrowconf["hm_dgth"])

        self.__hm_dgth = col2num(self.__hm_dgth_str)

        self.__hm_ttnt_str = (self.dicrowconf["hm_ttnt"])
        self.__hm_ttnt = col2num(self.__hm_ttnt_str)

        self.__hm_startrowvalue = int(self.dicrowconf["hm_startrowvalue"])
        self.__hm_vta = self.dicrowconf["hm_vt"]
        self.__hm_nca = self.dicrowconf["hm_nc"]
        self.__hm_mtca = self.dicrowconf["hm_mtc"]
        self.__hm_tha = self.dicrowconf["hm_th"]

        self.__hm_ct = self.dicrowconf["hm_ct"]
        self.__hm_ct_int = col2num(self.__hm_ct)

        self.__hm_vt =col2num (self.dicrowconf["hm_vt"]) 
        self.__hm_nc =col2num (self.dicrowconf["hm_nc"]) 
        self.__hm_mtc =col2num (self.dicrowconf["hm_mtc"])
        self.__hm_th =col2num (self.dicrowconf["hm_th"])
        self.__valuenotnone =self.dicrowconf["valuenotnone"]
        valueall =self.dicrowconf["valueall"]
        self.__dictvalue =self.dicrowconf["dictvalue"]
        # csv for dict 
        self.pathtovalue = refullpath(dirparhconf,self.__dictvalue)
        # csv for value 
        self.valuenotnone = refullpath(dirparhconf,self.__valuenotnone)
        # path all value 
        self.pathvalueall = refullpath(dirparhconf,valueall)

        self.__khns_rangenumbermct_ptvt =self.dicrowconf["khns_rangenumbermct_ptvt"]
        # hangmuccongtac 
        self.__hm_startpasterange = self.dicrowconf["hm_startpasterange"]
        self.__startpasterange = returnseplistintbbystr(self.__hm_startpasterange)
        self.__hm_congtac = self.dicrowconf["hm_congtac"]
        # add new##########################################################################33
        
        self.__khns_macongtac = self.dicrowconf["khns_macongtac"]
        self.__khns_noidungcongviec = self.dicrowconf["khns_noidungcongviec"]
        self.__khns_vattu = self.dicrowconf["khns_vattu"]
        self.__khns_nhancong = self.dicrowconf["khns_nhancong"]
        self.__khns_maytc = self.dicrowconf["khns_maytc"]
        
        self.__hm_th_formulas = self.dicrowconf["hm_th_formulas"]

        self.__khns_startrow = int(self.dicrowconf["khns_startrow"])
        # return list ma cong tac not node in cell value of ptvl by csv
        self.getvaluelist = convertcsvtolist(path=self.valuenotnone)
        # return all value from csv 
        self.getallvalue = convertcsvtolist(path=self.pathvalueall)

   
        self.pathlsn = refullpath(dirpath=getdirpath(pathconf),
                                        filename=self.dicrowconf["listsheetnamehm"])

        try:                        
            self.lsheetname = convertcsvto1list(path=self.pathlsn)
        except:
            pass
        self.__returnothervalue()
        self.__returnlistcongtac()