<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to run this java code in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-run-this-java-code/m-p/2269336#M47617</link>
    <description>You should create a routine.&lt;BR /&gt;Here is a tutorial&lt;BR /&gt;&lt;A href="https://www.talendbyexample.com/talend-code-routines-reference.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.talendbyexample.com/talend-code-routines-reference.html&lt;/A&gt;</description>
    <pubDate>Mon, 25 May 2020 07:17:44 GMT</pubDate>
    <dc:creator>TRF</dc:creator>
    <dc:date>2020-05-25T07:17:44Z</dc:date>
    <item>
      <title>How to run this java code</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-run-this-java-code/m-p/2269335#M47616</link>
      <description>&lt;P&gt;Hello Team,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Please can you help me. I wana run this code in Talend. The objectif is adding Password to xlsx File.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;import java.io.BufferedInputStream;&lt;BR /&gt;import java.io.FileInputStream;&lt;BR /&gt;import java.io.FileOutputStream;&lt;BR /&gt;import java.io.IOException;&lt;BR /&gt;import org.apache.poi.hssf.record.crypto.Biff8EncryptionKey;&lt;BR /&gt;import org.apache.poi.hssf.usermodel.HSSFRow;&lt;BR /&gt;import org.apache.poi.hssf.usermodel.HSSFSheet;&lt;BR /&gt;import org.apache.poi.hssf.usermodel.HSSFWorkbook;&lt;BR /&gt;import org.apache.poi.poifs.filesystem.POIFSFileSystem;&lt;BR /&gt;import org.apache.poi.ss.usermodel.Cell;&lt;/P&gt;
&lt;P&gt;public class ProtectedExcelFile {&lt;/P&gt;
&lt;P&gt;public static void main(final String... args) throws Exception {&lt;/P&gt;
&lt;P&gt;String fname = "C:\\Users\\ycham006\\Desktop\\REFRENTIEL_ITEM_BYTEL.xlsx";&lt;/P&gt;
&lt;P&gt;FileInputStream fileInput = null;&lt;BR /&gt;BufferedInputStream bufferInput = null;&lt;BR /&gt;POIFSFileSystem poiFileSystem = null;&lt;BR /&gt;FileOutputStream fileOut = null;&lt;/P&gt;
&lt;P&gt;try {&lt;BR /&gt;fileInput = new FileInputStream(fname);&lt;BR /&gt;bufferInput = new BufferedInputStream(fileInput);&lt;BR /&gt;poiFileSystem = new POIFSFileSystem(bufferInput);&lt;/P&gt;
&lt;P&gt;Biff8EncryptionKey.setCurrentUserPassword("secret");&lt;BR /&gt;HSSFWorkbook workbook = new HSSFWorkbook(poiFileSystem, true);&lt;BR /&gt;HSSFSheet sheet = workbook.getSheetAt(0);&lt;/P&gt;
&lt;P&gt;HSSFRow row = sheet.createRow(0);&lt;BR /&gt;Cell cell = row.createCell(0);&lt;/P&gt;
&lt;P&gt;cell.setCellValue("THIS WORKS!");&lt;/P&gt;
&lt;P&gt;fileOut = new FileOutputStream(fname);&lt;BR /&gt;workbook.writeProtectWorkbook(Biff8EncryptionKey.getCurrentUserPassword(), "");&lt;BR /&gt;workbook.write(fileOut);&lt;BR /&gt;}&lt;BR /&gt;catch (Exception ex) {&lt;/P&gt;
&lt;P&gt;System.out.println(ex.getMessage());&lt;BR /&gt;}&lt;BR /&gt;finally {&lt;BR /&gt;try {&lt;/P&gt;
&lt;P&gt;bufferInput.close();&lt;BR /&gt;}&lt;BR /&gt;catch (IOException ex) {&lt;/P&gt;
&lt;P&gt;System.out.println(ex.getMessage());&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;try {&lt;/P&gt;
&lt;P&gt;fileOut.close();&lt;BR /&gt;}&lt;BR /&gt;catch (IOException ex) {&lt;/P&gt;
&lt;P&gt;System.out.println(ex.getMessage());&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;</description>
      <pubDate>Fri, 22 May 2020 10:55:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-run-this-java-code/m-p/2269335#M47616</guid>
      <dc:creator>YacineCh</dc:creator>
      <dc:date>2020-05-22T10:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to run this java code</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-run-this-java-code/m-p/2269336#M47617</link>
      <description>You should create a routine.&lt;BR /&gt;Here is a tutorial&lt;BR /&gt;&lt;A href="https://www.talendbyexample.com/talend-code-routines-reference.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://www.talendbyexample.com/talend-code-routines-reference.html&lt;/A&gt;</description>
      <pubDate>Mon, 25 May 2020 07:17:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-run-this-java-code/m-p/2269336#M47617</guid>
      <dc:creator>TRF</dc:creator>
      <dc:date>2020-05-25T07:17:44Z</dc:date>
    </item>
  </channel>
</rss>

