Write a String into a text file
Whenever I have to write data into a text file following function has proven to fulfill my needs.
Source Code
In case you want to export a file in Unicode encoding you just hand True for the parameter isUtf16Le, which will cause the FileSystemObject to encode the file in UTF-16 with low byte order mark (little endian).
- Hits: 24353
Find last row in Excel file using POI
If you have to determine the last row in a Microsoft Excel file you will face some trouble.
For whatever reason there is no reliable method available in Excel VBA to retrieve the last row with data. Since Microsoft developers seem to have decided to treat formatting and data the same way when it comes to determining the so called UsedRange in a worksheet, we are officially screwed.
Here is what POI developers are stating in their API docs regarding this problem :0).
"Gets the number last row on the sheet. Owing to idiosyncrasies in the excel file format, if the result of calling this method is zero, you can't tell if that means there are zero rows on the sheet, or one at position zero. For that case, additionally call getPhysicalNumberOfRows() to tell if there is a row at position zero or not."Found at http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFSheet.html#getLastRowNum()
I fully agree: Excel's core implementation and resulting behavior is nuts many times.
- Hits: 29826
Remove line breaks from Oracle column
If you want to remove line breaks or other characters from Oracle fields, the following article might help.
One scenario is for example export of data into text files.
SQL
The above will replace all line breaks (chr(10)), all tabs (chr(09)) and all carriage returns (chr(13)) with a space (' ').
The Oracle function 'translate' is applied on the whole String and might show better performance than regular expressions depending on the complexity of your regex.
Enjoy.
- Hits: 23785
Page 2 of 8