Excel export: added a special case to add HYPERLINK Formula when text in the cell matches =HYPERLINK("link","name")
This commit is contained in:
parent
9ce77405e0
commit
7246fb5e34
@ -200,11 +200,22 @@ EOD;
|
||||
$cellXML .= ' s="' . $styleId . '"';
|
||||
|
||||
if (CellHelper::isNonEmptyString($cellValue)) {
|
||||
if ($this->shouldUseInlineStrings) {
|
||||
$cellXML .= ' t="inlineStr"><is><t>' . $this->stringsEscaper->escape($cellValue) . '</t></is></c>';
|
||||
$matches = array();
|
||||
if (preg_match('/=HYPERLINK\("(.*)","(.*)"\)/', $cellValue, $matches)) {
|
||||
// Special case to add HYPERLINK Formula
|
||||
$url = $this->stringsEscaper->escape($matches[1]);
|
||||
$text = $this->stringsEscaper->escape($matches[2]);
|
||||
$formula = sprintf('HYPERLINK("%s","%s")', $url, $text);
|
||||
$cellXML = sprintf(
|
||||
'<c r="%s%s" t="str"><f>%s</f><v>%s</v></c>',
|
||||
$columnIndex, $rowIndex, $formula, $text);
|
||||
} else {
|
||||
$sharedStringId = $this->sharedStringsHelper->writeString($cellValue);
|
||||
$cellXML .= ' t="s"><v>' . $sharedStringId . '</v></c>';
|
||||
if ($this->shouldUseInlineStrings) {
|
||||
$cellXML .= ' t="inlineStr"><is><t>' . $this->stringsEscaper->escape($cellValue) . '</t></is></c>';
|
||||
} else {
|
||||
$sharedStringId = $this->sharedStringsHelper->writeString($cellValue);
|
||||
$cellXML .= ' t="s"><v>' . $sharedStringId . '</v></c>';
|
||||
}
|
||||
}
|
||||
} else if (CellHelper::isBoolean($cellValue)) {
|
||||
$cellXML .= ' t="b"><v>' . intval($cellValue) . '</v></c>';
|
||||
|
Loading…
x
Reference in New Issue
Block a user