G
G
Grigory Tumakov2015-03-27 09:52:57
PHP
Grigory Tumakov, 2015-03-27 09:52:57

How to extract cell comments in phpexcel?

Good afternoon.
I need to pull out a comment (note) from a cell, I do it as follows:

echo (string)$worksheet->getCommentByColumnAndRow($row, $col)->GetText();

But instead of the text:
фывфффффффы sadssssasd 231 #$#%*(&@
I get the text:
DK2DDDDDDDK sadsss
It turns out that Russian letters are encoded as English, and some are cut off altogether.
As far as I know this Excel file was made by 1C.
How to pull out a comment with Russian words?
Solution:
Convert file from xls to xlsx

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Grigory Tumakov, 2015-03-27
@VokaMut

It was decided by resaving the document from xls to xlsx.
XLS does not support comments even if they are saved and displayed in MsExcel 2007+
Converting from xls to xlsx:

$objPHPExcel = PHPExcel_IOFactory::load("XMLTest.xml");
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('covertedXml2Xlsx.xlsx');

But now the comments turn from: to
:
9_x0004_F_x0004_C_x0004_:_x0004_5_x0004_=_x0004_3_x0004_H_x0004_I_x0004_7_x0004_E_x0004_J_x0004_D_x0004_K_x0004_2_x0004_0_x0004_

В браузере отображается как:
9FC:5=3HI7EJDK20
И при копировании в блокнот++ между каждой буквой юникодный символ "EOT"

And many characters are cut off.
If you convert MsExcel, then everything is fine, even long comments.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question