New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Encoding support #30
Comments
@evserykh Sure I am. I'm about to release the next version of JODConverter. It should be out within a week. Not sure I understand your question. But everything you can do using OO only (without JODConverter) is doable with JODConverter. We just have to figure out how to do it programmatically. What are you tryinh to do exactly ? (what is you input and output format?). |
Sounds great, it would be amazing 👍 Let me explain what I mean. For example I have a csv file in cp1251 encoding and I want to convert it to a xls file. Using OO I have to open the csv file and select file's encoding to have it properly showed. Do you know is it possible to set input file's encoding for converting requests to jodconverter? |
OK got it. First, take a look at this wiki page to understand what I'm about to explain. The default filter options applied when a csv file is imported is What you want, according to this table, is You can change these default options by forcing a custom format as source format: Using the latest master: File inputFile = new File("document.csv");
File outputFile = new File("document.xls");
DocumentFormat csv = DocumentFormat.copy(DefaultDocumentFormatRegistry.CSV);
csv.getLoadProperties().put("FilterOptions", "44,34,34");
JodConverter.convert(inputFile).as(csv).to(outputFile).execute(); Using the 4.0.0 version: OfficeDocumentConverter converter = ...
File inputFile = new File("document.csv");
File outputFile = new File("document.xls");
final DocumentFormatRegistry registry = DefaultDocumentFormatRegistry.create();
DocumentFormat inputFormat = registry.getFormatByExtension("csv");
DocumentFormat outputFormat = registry.getFormatByExtension("xls");
inputFormat.getLoadProperties().put("FilterOptions", "44,34,34");
converter.convert(inputFile, outputFile, inputFormat, outputFormat); Note that I didn't test this but it should work as expected... |
@sbraconnier thanks a lot. I got what you meant, but I use jodconverter web app. I asked whether can I modify my requests to jodconverter web app to set input file's encoding. |
Hmm... Do you mean you use the jodconverter-sample-webapp sample ? If yes, my answer remains the same. The sample webapp is... well, just a sample. It is not too hard to send request parameters through a web request. You could add a drop down list of available encoding and send the selected option to the server using a request parameter (see query string). Server side, you would retrieve the request parameter using ServletRequest#getParameter and then use the retrieved encoding as shown in my previous answer. |
@sbraconnier I got it. Thanks a lot for help |
@sbraconnier are you going to support your branch?
Do you know does OO/jodconverter support converting with setting output file's encoding?
The text was updated successfully, but these errors were encountered: