Suppose there is an Excel table with Fields "Last Name", "Number", "Account", "TOTAL" in which there are N records.
I need to generate N html documents into which values ​​from the table fields should be substituted as parameters.
Simply put, you need to generate HTML receipts. What means can this be done? Perhaps there are ready-made solutions?

  • First you need to decide on the language of development. What means can this be done? for example in PHPExcel . - Alex

1 answer 1

The described functionality is implemented using two MS Excel sheets and a VBA macro as follows:
but. The first sheet contains lines with information about Surnames, Numbers, Accounts, TOTAL, etc .;
b. The 2nd sheet contains the reporting form containing references to a line from the 1st sheet;
at. a macro that scans the data of the 1st sheet and inserts it into the 2nd sheet and saves it as Html.

1st sheet (data)
1st sheet (data)

2nd sheet (reporting form)
2nd sheet (reporting form)

Macro code

Sub MovingАlongTheLines() Dim i As Long Dim LastRow As Long Dim strDtSet As String Dim strRpFrm As String Dim strFile As String 'блокируем вывод предупреждения при сохранении Html о персональных данных Application.DisplayAlerts = False 'список используемых листов 'лист с исходными данными strDtSet = "1-ИсхДн" 'лист с отчетной формой strRpFrm = "2-Отч" 'определяем количество строк на листе strDtSet LastRow = Cells(Rows.Count, 1).End(xlUp).Row 'сканиурем строки листа strDtSet For i = 2 To LastRow 'в лист strRpFrm подставляем значения из листа strDtSet 'Фамилие определяем Worksheets(strRpFrm).Cells(3, 2) = Cells(i, 1) 'Номер счета Worksheets(strRpFrm).Cells(5, 2) = Cells(i, 3) 'ИТОГО Worksheets(strRpFrm).Cells(7, 2) = Cells(i, 4) 'определяем имя файла для сохранения в формате Html strFile = Format(Now(), "yyyy mm dd\_hh-mm") _ & " " _ & Cells(i, 1) _ & ".html" strFile = ThisWorkbook.Path & "\" & strFile 'сохраняем файл Worksheets(strRpFrm).SaveAs Filename:=strFile, FileFormat:=xlHtml Next i 'закрываем все книги ActiveWorkbook.Close End Sub 

Run the macro MovingAlongTheLines and get the result.