Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • P PHP_XLSXWriter
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 101
    • Issues 101
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 24
    • Merge requests 24
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • mk-j
  • PHP_XLSXWriter
  • Merge requests
  • !70

Fixed issue: Zeros(0) are written as strings

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/c-schmitz/master into 2016-rollup 8 years ago
  • Overview 1
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: c-schmitz

All integer numbers are automatically written out as numbers in the spreadsheet except for zeros. This patch fixes this inconsistency.

Compare
  • 2016-rollup (base)

and
  • latest version
    97837a91
    1 commit, 2 years ago

1 file
+ 4
- 4

    Preferences

    File browser
    Compare changes
xlsxwriter.class.php
+ 4
- 4
  • View file @ 97837a91

  • Edit in single-file editor

  • Open in Web IDE


@@ -43,12 +43,12 @@ class XLSXWriter
}
}
}
public function setTempDir($dir)
{
$this->temp_dir = $dir;
}
protected function tempFilename()
{
$temp_dir = is_null($this->temp_dir) ? sys_get_temp_dir() : $this->temp_dir;
@@ -301,7 +301,7 @@ class XLSXWriter
$sheet->file_writer->close();
$sheet->finalized=true;
}
public function markMergedCell($sheet_name, $start_cell_row, $start_cell_column, $end_cell_row, $end_cell_column)
{
if (empty($sheet_name) || $this->sheets[$sheet_name]->finalized)
@@ -347,7 +347,7 @@ class XLSXWriter
$file->write('<c r="'.$cell_name.'" s="'.$cell_format_index.'" t="n"><v>'.self::xmlspecialchars($value).'</v></c>');//int,float,currency
} else if (!is_string($value)){
$file->write('<c r="'.$cell_name.'" s="'.$cell_format_index.'" t="n"><v>'.($value*1).'</v></c>');
} else if ($value{0}!='0' && $value{0}!='+' && filter_var($value, FILTER_VALIDATE_INT, array('options'=>array('max_range'=>2147483647)))){
} else if ($value{0}!='+' && filter_var($value, FILTER_VALIDATE_INT, array('options'=>array('max_range'=>2147483647)))!==false){
$file->write('<c r="'.$cell_name.'" s="'.$cell_format_index.'" t="n"><v>'.($value*1).'</v></c>');
} else { //implied: ($cell_format=='string')
$file->write('<c r="'.$cell_name.'" s="'.$cell_format_index.'" t="s"><v>'.self::xmlspecialchars($this->setSharedString($value)).'</v></c>');
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Administrator
Reference: mk-j/PHP_XLSXWriter!70
Source branch: github/fork/c-schmitz/master

Menu

Explore Projects Groups Snippets