Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 2.20 KB | None | 0 0
  1. // Создадим объект-приложение MS Excel
  2.       ExcelApplication = CreateObject('Excel.Application')
  3.  
  4. // Откроем документ Excel
  5.       Workbook = ExcelApplication.Workbooks.Add()
  6.      
  7.  
  8.      
  9.      
  10. //Подключаемся к ЭД
  11.       doc1 = edocuments.getobjectbyid('108986')
  12.       doc2 = edocuments.getobjectbyid('109966')
  13.      
  14. //
  15.       //sn = doc1.SQLTableName
  16.       //sn =
  17.       //ShowMessage(sn)
  18.      
  19.  //Присваиваю имя листу в екселе равному ИД карточки  //переходим к первому листу
  20.       Sheet1 = Workbook.Sheets.Item(1)
  21.      
  22.            
  23.              
  24. //Выдераем наменование реквизитов doc1
  25.            
  26.         Count = doc1.RequisiteCount()
  27.                
  28.         i = 0
  29.         while  i <= Count-1
  30.        
  31.             doc1.RequisiteByIndex(i)
  32.                 workbook.sheets(1).rows(i+1).columns(1).formula = doc1.RequisiteByIndex(i).name
  33.                 workbook.sheets(1).rows(i+1).columns(2).formula = doc1.RequisiteByIndex(i).value
  34.                 workbook.sheets(1).rows(i+1).columns(3).formula = doc1.RequisiteByIndex(i).DataType
  35.             i = i+1
  36.         endwhile
  37.  
  38. //Присваиваю имя листу в екселе равному ИД карточки  //переходим к первому листу
  39.       Sheet2 = Workbook.Sheets.Item(2)
  40.                      
  41. //Выдераем наменование реквизитов doc2
  42.            
  43.         Count = doc2.RequisiteCount()
  44.                
  45.         i = 0
  46.         while  i <= Count-1
  47.        
  48.             doc2.RequisiteByIndex(i)
  49.                 workbook.sheets(2).rows(i+1).columns(1).formula = doc2.RequisiteByIndex(i).name
  50.                 workbook.sheets(2).rows(i+1).columns(2).formula = doc2.RequisiteByIndex(i).value
  51.                 workbook.sheets(2).rows(i+1).columns(3).formula = doc2.RequisiteByIndex(i).DataType
  52.             i = i+1
  53.         endwhile
  54.                            
  55.  
  56.  
  57.                
  58.          
  59. //Сохраняем файл
  60.      Workbook.SaveAs("C:\1\4501342.xls")
  61.  
  62. //Закрываем
  63.       Workbook.Close()
  64.       ExcelApplication.Quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement