Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 16:06
    RaSh-Weerasinghe starred PHPOffice/PhpSpreadsheet
  • 15:26

    oleibman on master

    Xlsx Writer Unhides Explicitly … (compare)

  • 15:26
    oleibman closed #2414
  • 15:26
    oleibman closed #1641
  • 15:08
    oleibman synchronize #2414
  • 09:51
    emadpoursina starred PHPOffice/PhpSpreadsheet
  • Dec 04 21:56
    ReynerHL starred PHPOffice/PhpSpreadsheet
  • Dec 04 19:28
    oleibman commented #2435
  • Dec 04 19:09
    oleibman opened #2435
  • Dec 04 18:43
    oleibman closed #2212
  • Dec 04 18:43
    oleibman commented #2212
  • Dec 04 18:40
    oleibman closed #2379
  • Dec 04 18:40
    oleibman commented #2379
  • Dec 04 18:39
    oleibman closed #2347
  • Dec 04 18:39
    oleibman commented #2347
  • Dec 04 18:33
    oleibman closed #1825
  • Dec 04 18:33
    oleibman commented #1825
  • Dec 04 18:32
    oleibman closed #1883
  • Dec 04 18:32
    oleibman commented #1883
jbtsp
@jbtsp
I think I followed the "correct approach to requesting a feature enhancement". I thought I might have at least a comment or 2 about this.
link97381
@link97381
Can anybody tell me if it's possible to add a Form Control Button to my spreadsheet to activate a macro(I already managed to figure out the process of adding the macro)?
Adrien Crivelli
@PowerKiKi
Megladon
@IPMegladon
Hi I have tried various ways and want to know if PhpSpreadsheet supports graph with a secondary y-axis and if not if there is any alternative or patch I can use to do this. I am opening up a template spreadsheet and inserting values for the charts. Furthermore is there a way I can set the font elements of the graphs or simply prevent the font size and type from changing when I open and then save the template file. Thanks!
sasr22
@sasr22
Hey! I am having problems with removing a row from a worksheet, I am trying to remove it like this
$spreadsheet->getActiveSheet()->removeRow(RowNum);
Mark Baker
@MarkBaker
What problem are you having with removeRow() @sasr22 ? What does it do? Does it error?
@IPMegladon There's no code in the charting for PhpSpreadsheet that works with a secondary axis, if you want to provide a patch, we're always happy to accept contributions
sasr22
@sasr22
@MarkBaker I feel so dumb, the function works fine, I how ever, don't work fine as I forgot to import PHPSpreadsheet. After I imported it it worked fine.
akalogiros
@akalogiros
anyone knows if phpspreadsheet supports poisson.dist calculations?whenever i try to get a cell calculated field with Poisson ,script crashes.
Fräntz Miccoli
@frantzmiccoli
@akalogiros find . |grep -s POISSON comes back empty handed so I guess it's not
Rubén Rubio
@rubenrubiob

Hi!

I am trying to read a XLS spreadsheet and I want all values to be strings, i.e., I do not want them to cast to any type. The problem I have is that I have some large numbers that are EAN codes, and the readers converts them to float with scientific notation, therefore, not valid numbers. For example, I have the code 123456789012345000 that is read as 1.2345678901234E+17.

I have tried many options to achieve this, trying to use a custom ValueBinder, as it seems the most legit option. This is the code I have:

$binder = new class extends DefaultValueBinder {
    public function bindValue(Cell $cell, $value)
    {
        $cell->setValueExplicit($value, DataType::TYPE_STRING);
        return true;
    }
};

Cell::setValueBinder(
    $binder
);

$reader = IOFactory::createReaderForFile($path);
$reader->setReadDataOnly(true);
$spreadsheet = $reader->load($path);

$rows = $spreadsheet->getActiveSheet()->toArray(null, false, false);

No matter what I try, I can not get it to work, it never goes through my ValueBinder, and I have not found anything in the documentation. Any help?

Thank you!

Fräntz Miccoli
@frantzmiccoli
@rubenrubiob I don't know the innerworkings of setValueExplicit but the casting of your value to string it probably the normal one in PHP. Check this https://stackoverflow.com/questions/1471674/why-is-php-printing-my-number-in-scientific-notation-when-i-specified-it-as-00 you might find a few useful hints.
Rubén Rubio
@rubenrubiob

Yes, I know that that happens. The thing is that I lose precision in the number. For example, 123456789012345000 becomes "123456789012344992.000000" when I do an sprintf('%f', $var). But it is not a number, it is a string, and I want it to be read as string in the beginning; if it is read as a string and not as a number, I think I will be able to solve the problem.

I will keep looking for a solution.

Thanks for your answer @frantzmiccoli !

Another thing is that the reader never calls my ValueBinder, so line

$cell->setValueExplicit($value, DataType::TYPE_STRING);

is never called.

Fräntz Miccoli
@frantzmiccoli
never used that, no clue
chimes325
@chimes325
When I used phpspreadsheet to load excel, I found that it read the calculation formula filled in the form. Is there any way to read the final value of the form? thx
Judah Wright
@judahnator_gitlab
Howdy folks!
I am working on a problem and my google-fu is not cutting it. The gist is I need to make sure that text does not overflow a cell, with the problem being that I am using merged cells and Excel does not support auto-height with merged cells. SO, is there a simple way to check if the text in a given cell is overflowing? If so I could increment the row height until all text is visible.
chimes325
@chimes325
@PowerKiKi thanks for u help!
Tolga Ozses
@kartagis
hello
I have an issue, and it would be too long to describe it here. I'm wondering if it's a bug. Would anyone be so kind to look at https://drupal.stackexchange.com/q/275922/17632 ?
Adrien Crivelli
@PowerKiKi
@kartagis not a bug in PhpSpreadsheet. You are most likely not giving a path on disk to an existing file, but instead giving some sort of URL or custom Drupal path references
Tolga Ozses
@kartagis
@PowerKiKi it was a typo on my side. I used ::createReaderFromFile($uri) and ::load($filename)
Fräntz Miccoli
@frantzmiccoli
@MarkBaker do you think you would have time to give a look at? PHPOffice/PhpSpreadsheet#844 (see also PHPOffice/PhpSpreadsheet#818 )
Infernus
@Infernus101
hello anyone there?
need help to setup phpspreadsheet with codeigniter
Khine Wai Oo
@khinewaioo_gitlab

Hello? Anyone in here?
I setup the page my excel file with Page Layout view and width.
getSheetView()->setView(SheetView::SHEETVIEW_PAGE_LAYOUT) and
getPageSetup()->setFitToWidth(1);

The problem is that I start the excel with Microsoft 2007, Pagesetup width is not work.
When I click anything in menu of excel.
Pagesetup width is work.

Is it problem of Excel or Is there any code to solve that problem?

JMLucas
@JMLucas96
When I use $writer->save($filename); on wich location is saving file?
JMLucas
@JMLucas96

When I use

$writer->save("/wp-content/uploads/exports/test.xlsx");

I get following error

Could not close zip file /wp-content/uploads/exports/prova.xls.

JMLucas
@JMLucas96
solved
Med-Seif
@Med-Seif
HI!
Med-Seif
@Med-Seif

Is there a way to apply a border style for a range of cells other than the default method :

$spreadsheet->getActiveSheet()->getStyle('A1:E10')->getBorders()->getTop()->setBorderStyle(\PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK);

This method applies the border for the whole block and not each cell

Fräntz Miccoli
@frantzmiccoli
@Med-Seif I am pretty sure you have utilitary function than could give you a cell array from a cell range. like A1:E10 --> ['A1', 'A2', ...]
amosfolz
@amosfolz

@Med-Seif I think you may find this helpful: https://phpspreadsheet.readthedocs.io/en/develop/topics/recipes/#styles
You can use allBorders like

$stlyes = [
  'borders' => [
        'allBorders' => [
            'borderStyle' => Style\Border::BORDER_THICK,
        ]
]

This will apply border to each cell in the range you have selected, rather than to just the outer cells.

Miguel Ángel Sánchez Palafox
@gueroverde
Hello, there is a way to format as a table?
Angelo D'Errico
@angeloderrico_gitlab
Hello, there is anyone that solved secondary Y-Axis for Charts?
@IPMegladon Hi, have you solved your issue on secondary Y-Axis?
LauKL1991
@LauKL1991

Hello all,

Is there any way to open a password protected excel file? Given the password always be the same. (Or it is better i can pass/key in the password to open the file).

Thanks.

Megladon
@IPMegladon
@angeloderrico_gitlab
No I haven't I wasnt able to fully understand the implementation of the axis and
Therefore couldnt write the code for reading and writing the secondary axis as well
Med-Seif
@Med-Seif
@amosfolz Thank you, that helped me a lot, I found that I wanted from The additional shortcut borders in addition to allBorders : horizontal, vertical etc...
@frantzmiccoli Thank you, that should be interesting but I prefer apply a style on a range of cells performance needs
hschaaps
@hschaaps
Hi, we are trying to modify an excelsheet with PhpSpreadsheet but we are having issues with the LINEST formula not behaving the way it does in excel. In Excel it is possible to set a multidimensional array like this: =LINEST(T41:T51;K41:L51;1;1), however PhpSpreadsheet seems to require that both arrays are the same size. Is there a way to work arround this limitation?
eelmasllari
@eelmasllari
Hi! Is there a known problem with PhpSpreadsheet loading xlsx files with a chart sheet? I have a very simple file with only two sheets, one with the data (3 numbers), and the other sheet is a pie chart of those 3 numbers (not as object in a sheet - the whole second sheet is a chart). When I try to read the file, I get a Notice: Undefined index: rId2 in phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Xlsx.php on line 754. If the chart is as object in a normal sheet, the problem does not occur. Any clues/workarounds? Versions: PhpSpreadsheet 1.6, PHP 7.1.12, xlsx file created with Excel 2011 for Mac. Thanks!
(The Notice itself doesn't disturb me much, but the fatal error it causes does: Uncaught TypeError: Argument 1 passed to PhpOffice\PhpSpreadsheet\Reader\Xlsx::readColumnsAndRowsAttributes() must be an instance of SimpleXMLElement, boolean given)
ndumngalon
@ndumngalon
Hi Guys :) just wanna ask if anybody here was able to make the axis labels overlapping?Thanks in advance. BTW im trying it on a bar graph :)
Tolga Ozses
@kartagis
hello
luisbessa
@luisbessa
hello, is it possible to set a range of cells as a table ? i failed to find information about it
Flávio Alves
@flavio-alves
Hey guys, I can easily insert an image inside a sheet and at specific cell coordinates, but how can I set the cell dimensions to fit the image dimension?