Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am trying to print excel file and word document to printer, but I don't know how to do it in Java.
Can anyone please help me and provide the code example?
Desktop.getDesktop().print(new File("resume.doc"));
I found that if you seeking for source code, surely someone would vote you down. What you need should be an idea, or some hint to the solution only.
For printing Office documents from java, One way is to call .NET from java, but this one is very slow and if you want to integrate the source code, you need a bridge. If you want to write serious projects, this method seems too weak.
Another way is to use the Apache POI, as indicated by Nicholas. But POI also have some problem render Office documents. The positive sides is that it can be stable compared with calling .NET
For the java desktop way, seeing from java API, it seems to leave the solution to your OS. I am not sure about it. You can try it.
Anyway it is not a good way to print Microsoft things from Java, same applies to print PDF documents from .NET or other Microsoft things. Sigh!
Apache POI is one of the more useful libraries for doing MS Word on java.
And Java already has a printing library
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have seen lots of commercial (even free) software that offer to show you the password of a password protected office file.
I assume, this is relatively an easy piece of code to write (for the people who know what they are doing).
My questions are: (Assume we are using Java as programming language, but if you have answers that use another programming language, that's okay)
Microsoft stores the passwords in plaintext format? or encrypted?
Is brute force used while retrieving the password, or the software just goes and retrieves it from where it's saved inside the file?
How do we link the file (MyFile.docx) to the program. That is, what libraries are used? Which part of the file we need to go an search for the passwords?
I do not expect detail explanations or basics. Just some keywords and hints where to start. I see this as a good programming exercise.
Java will surely work nice, but give C# a try for Microsoft related stuff.
Now, it's probably neither plaintext nor encrypted: it's surely hashed. Take a look at Rainbow lookup tables for that, else: happy brute forcing! There are furthermore a lot of nice tutorials for opening/manipulating docx files out there, take a look here for starters. Good luck.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to write a program for my dad that will take an excel sheet with a bunch of tabs in one file and turn it into several files with a couple tabs. Is there a way to do this? I was trying to do it in Java, but if there is a better way to do it, I'd be interested.
You could use Apache POI. It was used in a project I worked on (although I didn't directly use it) and it seemed to do it's job. It probably has what you're looking for.
Outside of Java, I have heard that powershell has good integration with excel, although I have never actually used it for that purpose. Here's an article about it.
Hope this helps! Good luck!
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
So I am trying to write a program which can collect certain information from different articles and combine them. The step in which I am having trouble is extracting the article from the web page.
I was wondering whether you could provide any suggestions to java libraries/methods for extracting text from a web page?
I have also found this product:
http://www.diffbot.com/products/automatic/article/
and was wondering whether you think this is the way to go? If so can someone point me to a java implementation - cannot seem to find one although apparently it exists.
Many thanks
Clarification - I am more looking for an algorithm/library/method for detecting where where in an html dom tree a block of text that could be an article is located. Like Safari's reader function.
ps if you think this is much easier done in something like python just say - although my program has to run in Java as it should eventually run on a server (using java framework) I could try having it make use of python scripts - although would only do this if you advise that Python is the way to go.
Have a look at Apache Tika. It's meant to be used together with a crawler and can extract both text and metadata for you. You can also select various output types.
I have found an open source solution which was extremely highly rated.
https://code.google.com/p/boilerpipe/
A review on different text extraction algorithms:
http://tomazkovacic.com/blog/122/evaluating-text-extraction-algorithms/
It appears that diffbot does perform very well but is not open source. So in terms of open source, boiler pipe could be the way to go.
This is not the answer to every malformed HTML you can get, but most of the time jtidy does a good job cleaning the HTML and giving you an interface for accessing the various DOM nodes, and with that access to the text inside that nodes.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
For example, say I had the string
hunger > 80 then findFood();
or
distanceTo sun < 30 then moveAwayFrom(sun);
That's not the exact syntax of what I want, but does anyone know a simple way I could make it so that I can pass that onto an entity in a game and they will basically follow that? The only thing that spring to mind at the moment is making a huge block of if statements that parse the given string, but that feels really really ineffecient.
I'd like a second opinion, just to see if I'm overlooking something really simple here :/
Not an easy task! What you are basically saying is that you need to create a language.
This language will describe all possible commands which you will then parse and generate commands from.
Now you might be thinking to yourself "gee, I've never written a language before!". That's where ANTLR comes in. It allows you to write the grammar for your language, and then generate the parser/lexer that you will need to decode the commands. You can get an IDE for working with ANTLER called ANTLRWorks, and you should check out the getting started tutorial. You really will have to get over your "curse" of trouble with wiki pages and dive in here.
Along the way you will probably realize easier or more efficient ways to encode your commands so that you can later decode them. Some possible alternatives are embedding a scripting language which you will use to encode/decode the commands, such as Python, JavaScript, or Lua. I have seen Lua used in games before, you can read their statement on why they are popular in games here. Good luck!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to develop a simple way to generate a flowchart for websites.
Here is why I would need something like that:
At first one draws a flowchart in < insert-program-here > and exports it as a xml-file.
This xml-file shall be imported and unmarshalled by another program, which in this case is a Java-application which is nothing more than a graphical interface which a user can use to find his/her way to a specific solution by following the flowchart.
I hope I got it right so far..
Does anybody know a simple program that would export a flowchart as a xml-file so I can use it as mentioned above? Or is there another way that is more comfortable to accomplish my needs?
Thanks for any help!
Best regards.
Personally I would recommend yEd because I have had good experiences with it. It uses the XML Format GraphML by default so your users will not have to use an export-Function but can use the files produced when saving their work.
But I don't think one can answer your question with a simple "I recommend program X." because nobody knows what you really need. Maybe one program does not give you all features you want to have for your flowcharts. Maybe others are not cheap enough.
I think you will have to find the right one by yourself. To determine which program can do it for you could check several drawing applications. A list of flowcharting programs can be found in this question. If that is not enough you may use google to find more.