How to avoid java.lang.NoSuchMethodError: org.apache.poi.util.IOUtils.copy(Ljava/io/InputStream;Ljava/io/OutputStream;) in Apache POI

I got this error today: “java.lang.NoSuchMethodError:org.apache.poi.util.POILogger.log(I[Ljava/lang/Object;)V]” It looks different from your error, but quite similar. FYI, I’m using maven to manage jars. After some experiment, I found out the root case is the poi.jar and poi-ooxml.jar’s version are not consistent. This configuration will get an error: <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.12</version> </dependency> <dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.13</version> … Read more

Upload DOC or PDF using PHP

Don’t use the [‘type’] parameter to validate uploads. That field is user-provided, and can be trivially forged, allowing ANY type of file to be uploaded. The same goes for the [‘name’] parameter – that’s the name of the file as provided by the user. It is also trivial to forge, so the user’s sending nastyvirus.exe … Read more

Python: Convert PDF to DOC

If you have LibreOffice installed lowriter –invisible –convert-to doc ‘/your/file.pdf’ If you want to use Python for this: import os import subprocess for top, dirs, files in os.walk(‘/my/pdf/folder’): for filename in files: if filename.endswith(‘.pdf’): abspath = os.path.join(top, filename) subprocess.call(‘lowriter –invisible –convert-to doc “{}”‘ .format(abspath), shell=True)

batch file Copy files with certain extensions from multiple directories into one directory

In a batch file solution for /R c:\source %%f in (*.xml) do copy %%f x:\destination\ The code works as such; for each file for in directory c:\source and subdirectories /R that match pattern (\*.xml) put the file name in variable %%f, then for each file do copy file copy %%f to destination x:\\destination\\ Just tested … Read more

How read Doc or Docx file in java? [closed]

Here is the code of ReadDoc/docx.java: This will read a dox/docx file and print its content to the console. you can customize it your way. import java.io.*; import org.apache.poi.hwpf.HWPFDocument; import org.apache.poi.hwpf.extractor.WordExtractor; public class ReadDocFile { public static void main(String[] args) { File file = null; WordExtractor extractor = null; try { file = new File(“c:\\New.doc”); … Read more

Android how to open a .doc extension file?

Unlike iOS, Android itself does not support rendering .doc or .ppt files. You are looking for a public intent that allows your app to reuse other apps’ activities to display these document types. But this will only work for a phone that has an app installed that supports this Intent. http://developer.android.com/guide/topics/intents/intents-filters.html or if you have … Read more

Extract text from doc and docx

Here i have added the solution to get the text from .doc,.docx word files How to extract text from word file .doc,docx php For .doc private function read_doc() { $fileHandle = fopen($this->filename, “r”); $line = @fread($fileHandle, filesize($this->filename)); $lines = explode(chr(0x0D),$line); $outtext = “”; foreach($lines as $thisline) { $pos = strpos($thisline, chr(0x00)); if (($pos !== FALSE)||(strlen($thisline)==0)) … Read more