Html to excel delphi

HTML Office Library: bridge between desktop and web

The first Delphi library for reading all office formats (including PDF) and converting to HTML on the fly.

The HTML Office Library is designed to work with the most popular document formats and convert documents from any source (file, DB, etc) to HTML.

Converted document contains only plain HTML/CSS/SVG and can be displayed using HTML Component library or browser.

Library provides a uniform access to an entire document and its parts, document resources (fonts, images, etc) and properties (title, Table of Contents, etc).

HTML Office Library doesn’t depend on any external components (DLLs, OLE, ActiveX, etc) and is cross-platform. Fully written in Delphi and comes with full source code.

  • Rich Text Format (RTF)
  • MS Word 6-2007 binary format (DOC)
  • MS Word XML document (DOCX)
  • MS Power Point binary format (PPT)
  • MS Power Point XML format (PPTX)
  • MS Excel binary format (XLS)
  • MS Excel XML format (XLSX)
  • MS Excel XML binary format (XLSB)
  • Adobe PDF format (PDF)
  • Supercalc format (SXC)
  • EPUB (electronic books).
  • FB2 (electronic books).
  • Markdown.
  • Outlook Message (MSG)
  • MIME message (.EML)
  • Outlook databases (.OST, .PST)
  • The Bat! database (.TBB)
  • RAR archives
  • EMF/WMF to SVG conversion
  • TTF to WOFF conversion
  • TTF normalization
  • TTF to SVG conversion
  • CFF to TTF conversion
  • Adobe PostScript to TTF conversion.
  1. Simple document viewer: allows to view any document on hard drive using file tree on left side and HtPanel on right.
    https://delphihtmlcomponents.com/FileBrowser.zip
    To view final HTML press View in browser button. No installation required.
  2. Search Engine demo: create full text search index for documents located in selected folders and find any document from application or Web.
    https://delphihtmlcomponents.com/SearchEngine.zip
    No installation required. How to use: Run application (SearchEngine.exe). Click Add folder and select folder containing office documents or Outlook PST/OST databases. Click Start indexing, wait until it is completed. Search for documents using one of the following: a) Go to Search tab and enter search query (any words). b) Click Web interface icon and enter search query.

Source code of both applications is included.

Источник

Delphi, Export HTML table to Excel

I found the solution. HTML Table Parsing in Less than a second!

function HTMLCleanUp(L : string) : string; var P1,P2 : integer; begin P1 := Pos(' <',L); //clean-up anything between <>while (P1>0) do //WHILE1 begin P2 := Pos('>',L); if (P2>0) then Begin Delete(L,P1,P2-P1+1); end; P1 := Pos('<',L); end; //WHILE1 L:=StringReplace(L,' ','-',[rfReplaceAll]); Result := Trim(L); end; procedure TForm11.WB_SaveAs_HTML(WB : TWebBrowser; const FileName : string) ; var PersistStream: IPersistStreamInit; Stream: IStream; FileStream: TFileStream; begin if not Assigned(WB.Document) then begin ShowMessage('Document not loaded!') ; Exit; end; PersistStream := WB.Document as IPersistStreamInit; FileStream := TFileStream.Create(FileName, fmCreate) ; try Stream := TStreamAdapter.Create(FileStream, soReference) as IStream; if Failed(PersistStream.Save(Stream, True)) then ShowMessage('SaveAs HTML fail!') ; finally FileStream.Free; end; end; (* WB_SaveAs_HTML *) procedure TForm11.Button1Click(Sender: TObject); const xlExcel7 = $00000027; TmpFileName='c:\test\xxxx.txt'; CRLF = #13#10; CSVTempSeparator = #9; //#255; //replaced by a comma ADPNEWHOTURL = 'http://samples.msdn.microsoft.com/workshop/samples/author/tables/HTML_Table.htm'; VAR Excel, WS: Olevariant; P1,P2,P3,P4, p5, P6, p11, p22 : integer; i, j: Integer; buffer,rawHTM,TmpStr,CSVStr:string; HTMFile : TextFile; CSVSTRList : TStringList; begin CSVSTRList := TStringList.Create; WB_SaveAs_HTML(WebBrowser1,TmpFileName) ; AssignFile(HTMFile, TmpFileName);//read the HTML file Reset(HTMFile); while not EOF(HTMFile) do begin ReadLn(HTMFile, buffer); rawHTM := Concat(rawHTM, buffer); end; i:=1;j:=1; rawHTM := Trim(StringReplace(rawHTM,CRLF,'',[rfReplaceAll])); P1 := PosEx('FIRST ROW while (P1>0) do //while1 begin P2 := PosEx('0) //if1 then begin TmpStr := Copy(rawHTM,P1,P2-P1+1); CSVStr := '';p11:=1;p22:=1; P11 := PosEx('0) do //while2 begin P22 := PosEx('0) //if2 then begin CSVStr :=CSVStr+ HTMLCleanUp(Trim(Copy(TmpStr,P11,P22-P11)))+CSVTempSeparator; j:=j+1; end //if2 else begin Exit; end; //if2 P11 := PoseX('0) do //while2 begin P22 := PosEx('0) //if2 then begin CSVStr :=CSVStr+ HTMLCleanUp(Trim(Copy(TmpStr,P11,P22-P11)))+CSVTempSeparator; j:=j+1; end //if2 else begin Exit; end; //if2 P11 := PosEx(' 
  • Delphi, Export HTML table to Excel
  • export delphi stringgrid to excel
  • Building Pivot Table in Excel via Delphi
  • How can I export only some columns from that ADOQuery to Excel using Delphi (any version)?
  • Can Delphi insert Excel 2007/2010 table
  • Provider selection, when trying to access Excel table in Delphi 7
  • Delphi export to Excel - false errors in IDE for code that compiles
  • Delphi - how do I export a rave report to Excel
  • Loading several html files into seperate sheets of one Excel Workbook using Delphi and OLE
  • Export Excel spreadsheet to PDF using OLE in Delphi XE3
  • Delphi export to Excel (.xlsx)
  • Delphi 2007 - I want to Read an .html file's content and then using ADO Insert or Update a SQL Server 2008 table with the HTML content
  • how get index of HTML Table for given element using delphi
  • Delphi - Is there a suitable WYSIWYG HTML Editor Component for VCL/FMX app?
  • Exporting to excel from Delphi without having excel
  • Open source component or unit for exporting Delphi TDataSet to native XLS without Excel installed
  • Export a global symbol from a Delphi DLL
  • How to get Delphi Currency Type to Round like Excel all the time?
  • How to prevent Delphi ADO from loading the entire table into memory?
  • Best Lightweight HTML Parser for Delphi
  • Reading Excel spreadsheets with Delphi
  • Generate HTML e-mail with embedded images in Delphi
  • How to get the string table resource id of a Delphi resourcestring?
  • How to set a range of different formulas to an Excel range from Delphi code?
  • Are there OpenOffice.org export components for Delphi (non-OLE)?
  • Excel 2010 automation constants not working in Delphi XE7
  • Delphi GLScene export scene as stl
  • Checking whether there are object attribute values in the HTML Code using Delphi
  • delphi html decode
  • delphi ole excel container, save file
  • Is there some functionality in/for Delphi that converts a string with html named and numbered entities to unicode text?
  • How to monitor SQL server database table from delphi application
  • Delphi - How do I make a WYSIWYG HTML editor using Delphi?
  • Get text[] value from sql table with FireDAC on Delphi
  • Delphi 7 Excel Ole object text font color
  • How can I export a DBGrid to OOXML format (Excel 2007/2010 format) without Excel installed?
  • Delphi map database table as class
  • How to import an Excel file into Access database, using delphi
  • How to use CHM HTML Help file with Delphi XE application?
  • Excel Column Autofit from Delphi XE2
  • Installing HTML Components into Delphi XE
  • Delphi - pass table valued parameter to SQL Server stored procedure
  • Delphi Excel COM-Addin
  • Delphi Insert data from StringGrid to a Database Table
  • Need a good way using Delphi to 'rotate' (pivot?) data in a flat table
  • What does an MVC Delphi with WebBroser and HTML application look like?
  • "Interface not supported" error when attempting to open Excel or Word from Delphi
  • Delphi export HKEY_CURRENT_USER key not working - empty result file
  • Reading HTML content from Clipboard in Delphi
  • Exporting from SQLite to Excel in Delphi

More Query from same tag

  • How to disable the splash screen on iOS?
  • Client - Server on Local Wifi delphi XE7 Project VCL
  • Pascal Access Violation when calling a variable in a class
  • Application portablity between Windows versions
  • How to create an auto-property faster in Delphi IDE?
  • Accessing Android sensors in Embarcadero XE5
  • How to replace empty except block?
  • Maximum Length of String in Delphi property Lines of TMemo
  • Thread context on Delphi
  • DataModule created before main form
  • mark regions in (Gantt) Chart
  • Delphi: reintroduce and overload a virtual procedure
  • working with dll ocx in delphi
  • How to change properties of a TlistBoxItem in a android app in runtime?
  • Any way to implement dynamic_cast on a DelphiInterface to obtain underlying objects class?
  • DropDownCount not working with OwnerDrawFixed style
  • How can I get the name of the database a DBExpress TSqlConnection is actually connected to?
  • Windows API safe termination of thread
  • How to get MAC address in windows7?
  • E2161 Error: RLINK32: Too many resources to handle. Delphi Error
  • delphi remove . and .. from path
  • Correct the value on datetimepicker when user selects a date
  • Google Maps inside Delphi 2009 Application
  • TTreeViewItem deselection
  • Someone managed to install InstantObjects in Delphi XE4?
  • SendMessage from a Delphi app to a Java app RICHEDIT50W control
  • which one is better in terms of performance, the early binding or late binding in Delphi COM objects
  • Is it possible to access a 64-bit dll from a 32-bit application?
  • Why I'm getting "Invalid pointer operation" when I try to implement an interface?
  • Fade an image using GDI+ (i.e. Change only the Alpha channel of a TGPGraphic)
  • How do I save the contents of TWebBrowser, including user-entered form values?
  • delphi - how to get the progress of socket.SendStream?
  • The Fastest Way to Load an Array DML in Delphi FireDAC
  • How to find out the BDE's shared memory area's actual location and size programmatically?
  • How can i debug my DLL project with Delphi's PAServer

Источник

Delphi, экспорт HTML таблицы в Excel

Все, что я хочу сделать, - это реализовать опцию "Экспорт в Excel" классического веб-браузера для команд Delphi2007. Когда я использую эту опцию из веб-браузера для экспорта таблицы из 12000 строк, это занимает меньше минуты экспортировать таблицу из любого веб-браузера из windows. Попытка реализовать это в Delphi с использованием 2D-массива занимает 10 минут. Попытка реализовать экспорт с помощью метода синтаксического анализа (списки строк, строки, Pos(tr), pos (td) и некоторые другие строковые функции) занимает много времени.. Следовательно, каковы команды веб-обозревателя для экспорта html-таблицы, чтобы преуспеть в том, что мне нужно преобразовать их в Delphi? Должен ли я использовать JavaScript внутри Delphi? Должен ли я использовать указатели? Должен ли я использовать HTML-сущности? xml. Есть идеи? Заранее спасибо.

Excel:= CreateOleObject('Excel.Application'); ovTable := WebBrowser1.OleObject.Document.all.tags('TABLE').item(0); arrayn:=VarArrayCreate([1, ovTable.Rows.Length, 1, ovTable.Rows.Item(1).Cells.Length], varvariant); for i:=0 to (ovTable.Rows.Length - 1) do begin for j := 0 to (ovTable.Rows.Item(i).Cells.Length - 1) do Begin arrayn[i+1, j+1]:=ovTable.Rows.Item(i).Cells.Item(j).InnerText; Application.ProcessMessages; end;end; WS.range[ws.cells[1, 1], ws.cells[ovTable.Rows.Length, ovTable.Rows.Item(1).Cells.Length]].value:=arrayn; Excel.WorkBooks[1].SaveAs(directorylistbox1.Directory+'\'+'test.xlsx'); WS := Excel.WorkBooks.close; Excel.quit; Excel:=unassigned; 
function HTMLCleanUp(L : string) : string; const CSVTempSeparator = #255; //replaced by a comma CRLF = #13#10; var P1,P2 : integer; begin P1 := Pos(' <',L); //clean-up anything between <>while (P1>0) do //WHILE1 begin P2 := Pos('>',L); if (P2>0) then Begin Delete(L,P1,P2-P1+1); end; P1 := Pos('<',L); end; //WHILE1 L:=StringReplace(L,' ','-',[rfReplaceAll]); L:=StringReplace(L,'-01','',[rfReplaceAll]); L:=StringReplace(L,'-02','',[rfReplaceAll]); L:=StringReplace(L,'-03','',[rfReplaceAll]); Result := Trim(L); end; function HTMLTableToCSV(HTML,CSV : TStringList) : boolean; const CRLF = #13#10; CSVTempSeparator = #9; var P1,P2,P3,P4, p5, P6, p11, p22 : integer; S,TmpStr,CSVStr : string; begin Result := True; S := Trim(StringReplace(HTML.Text,CRLF,'',[rfReplaceAll])); P1 := PosEx('FIRST ROW CSVStr := ''; while (P1>0) do //while1 begin P2 := PosEx('0) //if1 then begin TmpStr := Copy(S,P1,P2-P1+1); //Delete(S,P1,P2-P1+1); CSVStr := ''; p11:=1;p22:=1; P11 := PosEx('0) do //while2 begin P22 := PosEx('0) //if2 then begin CSVStr := //CSVStr+Trim(Copy(TmpStr,P1+4,P2-P1-4));//+CSVTempSeparator; CSVStr+Trim(Copy(TmpStr,P11,P22-P11))+CSVTempSeparator; //Delete(TmpStr,P1,P2-P1+1); end //if2 else begin Result := False; Exit; end; //if2 P11 := PoseX('0) do //while2 begin P22 := PosEx('0) //if2 then begin CSVStr := //CSVStr+Trim(Copy(TmpStr,P1+4,P2-P1-4));//+CSVTempSeparator; CSVStr+Trim(Copy(TmpStr,P11,P22-P11))+CSVTempSeparator; //Delete(TmpStr,P1,P2-P1+1); end //if2 else begin Result := False; Exit; end; //if2 P11 := PosEx(' 

Источник

Читайте также:  Sqlite blob пример python
Оцените статью