anourvalar / office Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
When using one-dimensional table I want the data filled not to expand the area.
We have calculations for the fields at the right position on a sheet that uses the filled table. The formulas will be affected/touched when filling data with this package. We want the calculations to be untouched.
Is it possible?
How to group data? I have tried with the following data:
$data = [
'categories' => [
[
'name' => 'Category 1',
'products' => [
[
'name' => 'Product 1',
'quantity' => 1,
],
[
'name' => 'Product 2',
'quantity' => 2,
],
]
],
[
'name' => 'Category 2',
'products' => [
[
'name' => 'Product 3',
'quantity' => 3,
],
[
'name' => 'Product 4',
'quantity' => 4,
],
]
],
]
];
Result:
Or I misunderstand something?
How could I accomplish a negative value from the code given?
Excel doesnt allow the syntax [data.prop] for that.
Just a negative number is an example. I want to use formulas in general.
How can I use this construction so that line breaks work for me:
Write a newline character "\n" in a cell (ALT+"Enter")
In Microsoft Office Excel you get a line break in a cell by hitting ALT+"Enter". When you do that, it automatically turns on "wrap text" for the cell.
Here is how to achieve this in PhpSpreadsheet:
$spreadsheet->getActiveSheet()->getCell('A1')->setValue("hello\nworld");
$spreadsheet->getActiveSheet()->getStyle('A1')->getAlignment()->setWrapText(true);
I have set up a 1-dimensional table row similar to the "products" example in template1 spreadsheet.
One of the cells in the template of the 1-dimensional table row has conditional formatting set, so that depending upon the value of the cell it will change colour style.
This works correctly for the first row returned but does not appear to propagate to any other rows, however the text formatting is correctly propagated to all rows.
I can see using LibreOffice or Excel that the conditional formatting is simply not there on any row following the first.
I have several excel documents that have formulas within that will give an out of memory error - if I copy and paste just the values into a new spreadsheet the test script works.
I believe the answer having googled this would be to allow granular control over setPreCalculateFormulas within the SheetsService function but I don't know where to add that in - is it possible to expose this as an attribute? Setting it to false would stop the OOM in these cases without reworking the sheet.
Once open the exported file showing this error on loading
using code for reference:
(new \AnourValar\Office\SheetsService())
->generate(
'existing_document.xlsx', // path to template
$data,
false // input data
)
->saveAs(
'generated_document.xlsx', // path to save
\AnourValar\Office\Format::Xlsx // save format
);
I tried to insert an image with the name [map], but I get the error that insertImage method of SheetsInterface is not defined.
'bar' => function (\AnourValar\Office\Drivers\SheetsInterface $driver, $cell) {
$driver->insertImage('test.png', $cell, ['width' => 100, 'offset_y' => -45]);
return 'Logo!'; // replace marker "[bar]" with return value
}
We are trying to fill multiple tabs in Excel with data.
How do we accomplish multiple Excel tabs with data conversions?
Right now the component just takes the first sheet and not the other...
Hello
i discover a bug , when i mixed data repated and non repeated on 2 different lines, example here
if i my first line i put the columns [course.11.full_name], [course.13.full_name], [course.10.full_name] and [course.12.full_name],
and the line below repeated dynamic data such like : [user.cohort.courses.11.progress], this data will be display but on the wrong row, it will be display on the row -1
Best
Hi!
Encountered a bug
file \AnourValar\Office\SheetsService::handleData:226
if (is_null($value)) {
unset($data[$row][$column]);
}
if use a similar hook scheme
->hookValue(function (SheetsInterface $driver, $column, $row, $value, $sheetIndex) {
if ($value instanceof Hyperlink) {
$driver->sheet()
->getCell($column . $row)
->setHyperlink($value)
->setValue($value->getTooltip() ?? $value->getUrl());
return;
}
return $value;
})
snippets (example [VarName]) are not deleted from the outgoing document, when the variable value is empty..
I tried to comment, the snippet was cleared when the variable value was zero
//if (is_null($value)) {
// unset($data[$row][$column]);
//}
no idea how to solve such a problem?
Thanks for the help
One-dimensional table works only in 1 records in array.
having a multiple records in one array throw an PhpOffice\PhpSpreadsheet\Exception
Invalid cell coordinate {TRUE
Hi!
Any plans on making some performance optimizations in Parser.php? When we run our datasheets it takes around 30-300 seconds to traverse the data. Very slow loops inside Parser.php with multiple for-loops inside for-loops.
It feels like the package parhaps need some caching and loop optimizations.
Functions very slow are calculateDataSchema and replaceMarkers.
Package version 2.1.2.
Hello,
Il looking for creating a double step excel filling and i need to fill some cell with the viariable appelation : "[key_name]";
How can i do that ?
Many thank for this plugin that is easy to use ! :)
Hello Paul Redmond,
I want to input (template) docx format and output (saveAs) pdf format, if is this possible then please share sample code.
Mixer can support same first point (Ex. i have generate multiple docx from template and want to output(saveAs) a single pdf file) (Currently giving me Unhandled match case of type AnourValar\Office\Format error)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.