Click here to Skip to main content
15,905,781 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i would like to ask if anyone can help me with the java code that extract webpage and save the data to excel sheet

and extract pdf file and save it to excel sheet also

thank you and i am waiting help
Posted

This is not a simple issue, see here[^] for some guides on how to read and interpret data from a web page. To read from a PDF file and write to Excel you will probably need some third party libraries; try Google for both subjects to see what is available.
 
Share this answer
 
Comments
zarouni123 9-Mar-11 13:29pm    
can you give me what code should i use because its still not clear i am using java netbeans
Richard MacCutchan 9-Mar-11 16:17pm    
I have already given you the advice that this is a fairly complex task and you need to go and do some research on it. There is no simple piece of code to achieve what you want, it is a matter of research, study and practice.
I dont understand. Java code? JSP?

Also you should specify what exactly do you want to extract to .xls. One thing is to "convert" the webpage to PDF, for excel you need to specify what and where to save.

Anyway, because I'm not sure you're using JSP (or web development language at all..) you could accomplish it using Javascript

XML
<script language=javascript>
function exportToExcel()
{
var oExcel = new ActiveXObject("Excel.Application");
var oBook = oExcel.Workbooks.Add;
var oSheet = oBook.Worksheets(1);
for (var y=0;y<detailsTable.rows.length;y++)
// detailsTable is the table where the content to be exported is
{
for (var x=0;x<detailsTable.rows(y).cells.length;x++)
{
oSheet.Cells(y+1,x+1) =
detailsTable.rows(y).cells(x).innerText;
}
}
oExcel.Visible = true;
oExcel.UserControl = true;
}
</script>
<button onclick="exportToExcel();">Export to Excel File</button>

<table name="detailsTable">
<tr>
<td> hello
</td>
</tr>
</table>
 
Share this answer
 
Comments
zarouni123 9-Mar-11 13:27pm    
i am using java netbeans is the framework i am using for the application so could you help it is not java script

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900