Advertisement
brainode

QlikView Macro

Jun 18th, 2014
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Set workSheet=workSheets.WorkSheets(2)
  2. 'Set oSH = oXL.ActiveSheet
  3.  
  4. ''Блок имени листа
  5. workSheet.Name="Доли ТовКат"
  6. container="CT120_832496997"
  7. EntireCont=Array("CH531_321692226","CH547_187156428","CH538","CH536","CH542_243845106","CH574_301042769","CH539","CH537")
  8. bb=0
  9. cc=0
  10. countRow=2
  11. For j=0 to UBound(EntireCont)
  12.         Set objCont = ActiveDocument.GetSheetObject(container)      
  13.         Set objProp = objCont.GetProperties
  14.         objProp.SingleObjectActiveIndex = j
  15.         objCont.SetProperties objProp                                                                                   ''Ставим активным первую таблицу первого контейнера
  16.        
  17.         Set obj = ActiveDocument.GetSheetObject(EntireCont(j))
  18.        
  19.        
  20.         if j<>2 and j<>6 then
  21.        
  22.             obj.CopyTableToClipboard True
  23.                    
  24.         else
  25.        
  26.                         msgbox("Обработка изображения...")  
  27.                         timestamp = Year(Now())&"_"&Month(Now())&"_"&Day(Now())&"_"&Hour(Now())&"_"&Minute(Now())&"_"&Second(Now())    
  28.                         sPath="C:\Windows\Temp\"&timestamp&".png"
  29.                         'msgbox jpgName
  30.                         'ExportObjectToJpg EntireCont(j), sPath
  31.                         ActiveDocument.GetSheetObject(EntireCont(j)).ExportBitmapToFile sPath
  32.             'obj.CopyBitMapToClipboard
  33.            
  34.         end if
  35.         sCaption=obj.GetCaption.Name.v
  36.         if j<4 then
  37.             if j=2 then
  38.                 'msgbox("A"&countRow)
  39.                 workSheet.Range("A"&countRow).Select
  40.                 workSheet.Pictures.Insert(sPath)
  41.             else
  42.                 workSheet.Paste     workSheet.Range("A"&countRow)                                                                                               ''Вставляем в Excel
  43.             end if
  44.         else
  45.             if j=6 then
  46.                 workSheet.Range(letter&countRow).Select
  47.                 workSheet.Pictures.Insert(sPath)
  48.             else
  49.                 workSheet.Paste     workSheet.Range(letter&countRow)                                                                                                ''Вставляем в Excel
  50.             end if
  51.         end if
  52.         cc = obj.GetRowCount                                                                                            ''Временно сохраняем количество строк в таблице
  53.         if bb<obj.GetColumnCount then
  54.             bb = obj.GetColumnCount
  55.         end if
  56.         letter=getColumnNameByIndex(bb+8)
  57.         countRow=countRow-1
  58.         if j<4 then
  59.             workSheet.Cells(countRow,1).Value=sCaption
  60.             workSheet.Cells(countRow,1).Font.Bold=True
  61.             workSheet.Cells(countRow,1).Font.Size=14
  62.         else
  63.             workSheet.Cells(countRow,bb+8).Value=sCaption
  64.             workSheet.Cells(countRow,bb+8).Font.Bold=True
  65.             workSheet.Cells(countRow,bb+8).Font.Size=14
  66.         end if
  67.         countRow=countRow+1
  68.         if j=2 or j=6 then
  69.             countRow=cc+countRow+7
  70.         else
  71.             countRow=cc+countRow+1
  72.         end if
  73.         if j=3 then countRow=2
  74. next 'j increment
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement