2011年6月6日星期一

讓 Spreadsheet Excel Writer 的字串斷行 (Line Break in Spreadsheet Excel Writer)

先編寫一個使用 Spreadsheet Excel Writer 輸出 Excel 檔案的 php 文件
並在儲存格中加入 \n 來將字串
Write a simple PHP file using Spreadsheet Excel Writer to export Excel file


利用 Microsoft Office Excel 開啟輸出的 Excel 檔案
發現儲存格字串並沒有斷行,可是輸入列卻顯示正常
Using Microsoft Office Excel to open the exported Excel file
You can discover the text in the cell does not have line break,
but you can see the line break in input text field


我們在剛才的 PHP 文件加上以下的語句
We add the additional statements in the PHP file


再使用 Microsoft Office Excel 開啟該檔案,終於讓儲存格的字串便會斷行
Using Microsoft Office Excel to open that file,
Final the cell represent the line break


很有趣地,若使用 OpenOffice.org 來開啟該檔案,即使沒有使用 setTextWrap(true) 亦可以顯示斷行
Interesting, using OpenOffice.org to open that file,
even without the use of setTextWrap (true), it can display a line break.

1 則留言 :

  1. Zip code database is the most important to searching the any address and country address. So you will use updated database here visit this site than get all zzip 4 info.

    回覆刪除