Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Franco Viacava
@snaker:matrix.org
[m]
hey bros
any?
Sonatique
@sonatique
Hello,
I need your help to solve the following issue: I have a given spreadsheet which features some partial cell protection (not created by me, cannot change, don't have password): some cells are not editable at all, while some can have only their content changed (but not format for instance).
I am using PhpSpreadsheet to modify values of some of the editable cells, it works perfectly fine, that's already very nice. I don't explicitely touch anyting regarding protection.
But the issue is: after I save the modified file, the protection is changed in an unexpected way: if I want to manually edit the file using MS Excel, I cannot change any cells, not even those ones I was able to edit before I used PhpSpreadsheet. It seems that the whole content is now edit-protected. The strange thing is that I can still use PhpSpreadsheet to edit content on this new file, but not with Excel.
Is this a known bug? Any workaround? Thanks a lot in advance.
komgrip
@komgrip
Hello, I would like to know how to set translucent background of chart
Franco Viacava
@snaker:matrix.org
[m]
someone knows how I can read the last excel that I upload
pls pl
pls
Hansl001
@Hansl001
Hi, After installing phpspreadsheet with composer just trying to use simple example but not getting past $spreadsheet = new Spreadsheet(); this throws a 500 server error. I am using php 7.3.28 ..any suggestions?
2 replies
mrofia
@mrofia

Hi, my spreadsheet has so many vlookup formulas. However the cells containing those formulas caused error when i use setPreCalculateFormulas(true)
the error is like below
psikogram!T9 -> Formula Error: An unexpected error occurred

T9 is the cell where the lookup formula is located

2 replies
Haqz
@Haqz
So while reading XLSX file i'm trying to get aligment of cell, but the $cell->getStyle()->getAlignment()->getHorizontal always returns general
Any idea why would that happen?
kanhaphp
@kanhaphp
I am trying to check Merge shell via PHPSpreadsheet but getting empty result by all such function for work sheet getMergeCells() for cell isInMergeRange any one can help me?
L L
@alpha1125
I have an excel date... lets say phpspreadsheet reports the value is 44175, but when I open it in excel, it's YYYY-mm-dd format. I'm trying to resave that value/format to a new cell... with the format YYY-mm-dd. what's the proper way of doing that?
1 reply
VitaliySavin
@VitaliySavin
Hi, please help me. A have XLS file that when opened in Libre office requires a password . How i can open it in PhpOffice\PhpSpreadsheet\Reader\Xls ?
in private function readFilepass() thrown exception 'Unexpected file pass record length'
Martin Santiago
@Tinchosan
¡Hi People! i have a problem with hyperlinks, i need link the cells from one sheet to anothers, but the problem is this: https://prnt.sc/1r5gyg0
When export the excel (xls) the hyperlink not work, my code is the next
public function sheets(): array
    {
        $sheets = [];
        if (!\Auth::user()->admin) {
            $farmacia_id = \Auth::user()->farmacia_id;
        }
        //$farmacia_id = 301;
        $vencimientos_generales = CuentaCorriente::where('farmacia_id', $farmacia_id)->orderBy('fecha_vencimiento_comprobante', 'ASC')->groupBy('fecha_vencimiento_comprobante')->select('fecha_vencimiento_comprobante')->get();
        $sheets[] = new CuentaCorrienteResumenSheet();
        foreach ($vencimientos_generales as $k => $vencimiento) {
            $sheets[] = new CuentaCorrienteVencimientoSheet($vencimiento->fecha_vencimiento_comprobante, $farmacia_id);
        }
        return $sheets;
    }

class CuentaCorrienteResumenSheet implements FromView, WithEvents, WithTitle
{
.
.
.
foreach ($event->sheet->getColumnIterator('A', 'A') as $row) {
                    foreach ($row->getCellIterator() as $cell) {
                        if ($cell->getValue()) {
                            $cell->getHyperlink()->setUrl("sheet://'25072021'!A1");
                            // $cell->setHyperlink(new Hyperlink("sheet://'25072021'", 'Read'));
                            $event->sheet->getStyle($cell->getCoordinate())->applyFromArray([
                                'font' => [
                                    'color' => ['rgb' => '0000FF'],
                                    'underline' => 'single'
                                ]
                            ]);
                        }
                    }
                }
}
Martin Santiago
@Tinchosan
Okey, the problem was the extension of file, need be "xlsx"
Mathieu Cambois
@mcambois_gitlab
Hi guys !
I have a problem about the Reader when I'm loading an uploaded file, the need of my development is to get the file when it's still in the request (FileBag) I'm aware of the fact that it's in a temporary folder and I can get the path through it but when I give it to the Reader with the load method it gave me a symfony error "Notice: Undefined index: rId1" and tell me that the problem is from the line 1049 in the Reader/Xlsx.php file.
Then, I tried to just move my uploaded file before trying to load it, and still have this error, I already try to give the getRealPath() or getPathname() but faced the same issue.
For more details I checked that the file exists and is not empty before give it to the Reader->load().
My File is an xlsx, and contain 2 sheets, I think it ("rId1") might be the number of sheets ("0", "1") and it can't get the last of them...
Any suggestions ? Link to read about that issue ?
Mathieu Cambois
@mcambois_gitlab

Hi guys !
I have a problem about the Reader when I'm loading an uploaded file, the need of my development is to get the file when it's still in the request (FileBag) I'm aware of the fact that it's in a temporary folder and I can get the path through it but when I give it to the Reader with the load method it gave me a symfony error "Notice: Undefined index: rId1" and tell me that the problem is from the line 1049 in the Reader/Xlsx.php file.
Then, I tried to just move my uploaded file before trying to load it, and still have this error, I already try to give the getRealPath() or getPathname() but faced the same issue.
For more details I checked that the file exists and is not empty before give it to the Reader->load().
My File is an xlsx, and contain 2 sheets, I think it ("rId1") might be the number of sheets ("0", "1") and it can't get the last of them...
Any suggestions ? Link to read about that issue ?

It might be an image error too because my first page contain one in a specific presentation with headers and footers, the image is in the header, maybe the reader can't set the path to this image and then throw this error ?

Mathieu Cambois
@mcambois_gitlab

It might be an image error too because my first page contain one in a specific presentation with headers and footers, the image is in the header, maybe the reader can't set the path to this image and then throw this error ?

That's it, when you put an image in your header, it try to get the path from it but can't load it properly and then throw this error, I tried to remove it and my development run without any problems.
I tried to change the insert way to put my image in the header, not as past with the local sample but with the online way "Searching it with bing" and still have this error, will it be possible to correct that ? I run it without any error last month so it's possible...

rincevent
@rincevent:matrix.org
[m]
Hi team
I'm trying to edit an axisting Xlsx file.
I load it with createReader("Xlsx")
I lanch the update
Create a writter and save it
My issue is about the rest of the grid of the xlsx. It all receive a style on border of cell.
How to keep my xlsx without those borders on all cells ? Did you already met the issue ?
$reader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader("Xlsx");
$spreadsheet = $reader->load($target_path_valid_file);

$sheet = $spreadsheet->getActiveSheet();
$last_row = (int) $sheet->getHighestRow();
$new_row = $last_row+1;

$sheet->setCellValue('A'.$new_row, "14");
$sheet->setCellValue('B'.$new_row, "Alina");
$sheet->setCellValue('C'.$new_row, "PG");
$sheet->setCellValue('D'.$new_row, "$32");
$sheet->setCellValue('E'.$new_row, "Pending");

$writer = \PhpOffice\PhpSpreadsheet\IOFactory::createWriter($spreadsheet, "Xlsx");
$writer->save($target_path_valid_file);
rincevent
@rincevent:matrix.org
[m]
All the row and col under/after the exiting data have the border set
I already tried to use the global BORDER_NONE but it work on the sheet loaded not on the rest.
Mathieu Cambois
@mcambois_gitlab
I faced the same issue because I was using a template where my sheet contains too much styled rows, are you using borders from col A to XFD ?
2 replies
asifcse07
@asifcse07
image.png
hi, is there anyone have idea how can I generate a chart like this in phpshpreadsheet? kindly help. i have multiple tabs in single excel sheet
Rickard Wettström
@Wetric
Hi. Is there a way to do a XLOOKUP(seems not to be implemented) or something similar to join data?
demokn
@demokn
Hi, when I save as html, the column width is not set. Is there a way to do so, fixed column width same as the original xls column ?
Frédéric Delaunay
@Dfred
Hi there. Is there a simple way to get an unbounded getCellIterator() from a Row ?
if I call $a_row->getCellIterator($column_out_of_bounds) a PhpSpreadsheetException is thrown
Frédéric Delaunay
@Dfred
ok my bad, my version of PhpSpreadsheet seems too old..
於志远
@yuzhiyuan
Hello everyone, I have a question. I imported data with PHPoffice from an excel file, when the field is Chinese string, the field result of sheetData is false. Is this a bug?
like this:
["D"]=>
string(6) "000690"
["E"]=>
bool(false)
Thanks!
9 replies
image.png
Sakthi01
@Sakthi01
Hi everyone, I have used $spreadsheet->getActiveSheet()->setAutoFilter('D4:Q4'); to set auto filter, like this is there any way to unset autofilter for a specific column.
AYCore
@Yryskeldi5
Hello everyone! I'm writing to developers of PhpSpreadsheet lib. I'm using Symfony framework version 5.3.1. I ran into error in xlsx file when opening through MS Excel. I update version of phpspreadsheet from 1.16 to 1.19 after that my xlsx file shows error with xml : Replaced component: part /xl/worksheets/sheet1.xml with XML error. Loading error. Line 2, column 0. and also shows empty table , but If I open in LibroOffice there's no problem, works fine. Firstly I put the version 1.16 and test, until 1.19 version works well. Pay attention to this err, I hope others will not face it.
shyamsasit
@shyamsasit
Hello friends,->getCell('B1')->getStyle()->getFill()->getStartColor()->getARGB() is only returning FFFFFFF for almost all cells but if cell is green its returning correctly
any idea?