Skip to content
This repository has been archived by the owner on Jan 2, 2019. It is now read-only.

Html reader, with rowspan + colspan + style #205

Closed
wants to merge 3 commits into from
Closed

Html reader, with rowspan + colspan + style #205

wants to merge 3 commits into from

Conversation

cifren
Copy link

@cifren cifren commented Jun 19, 2013

Class phpExcelReader :

  • Replacing private by protected
  • error at line 129, function strpos(string $haystack , mixed $needle)
  • add rowspan and colspan
  • add style (very very slow when used, use function applyFromArray), works only for alignment / numberformat (example: td{vertical-align:middle;phpexcel-number-format-code:"$#,##0.00;($#,##0.00)"})/ indent => see class CssPhpExcelTranslator.php
  • function autosize added and commented (working, need to be optional)

Class CssPhpExcelTranslator :

  • transform all css to array style form phpExcel
  • works only for few css, need to be fill up

Class CssParser :

  • parse all css to array

Class PhpExcelStyle :

  • give more flexibility for the future if we need more than an arrayStyle for phpExcel
  • Reformating and redid indentation

- Replacing private by protected, when you want to extends its too annoying
- error at line 129, function strpos(string $haystack , mixed $needle)
- add rowspan and colspan
- add style (very very slow when used, use function applyFromArray), works only for alignment / numberformat (example: td{vertical-align:middle;phpexcel-number-format-code:"$#,##0.00;($#,##0.00)"})/ indent  => see class CssPhpExcelTranslator.php
- function autosize added and commented (working, need to be optional)

Class CssPhpExcelTranslator :
- transform all css to array style form phpExcel
- works only for few css, need to be fill up

Class CssParser :
- parse all css to array

Class PhpExcelStyle :
- give more flexibility for the futur if we need more than an arrayStyle for phpExcel
@cifren
Copy link
Author

cifren commented Jun 19, 2013

I added require_once but I'm not sure if it will work, i use those files with namespace in Symfony2, so I'm not an expert with autoloader. Everything is already done in Sf2, hihi :)

@MarkBaker
Copy link
Member

Thanks. Interesting changes.... The rowspan and colspan was always on my "to do" list; and it looks as though you've cleaned up a lot of the existing code. I'll take a closer look at them later: I'm busy at the moment working on converting the develop_2.0.0 branch for namespacing; but I certainly appreciate the changes, and will look to merge them into that branch once I've tested all my namespace changes. That branch will also use protected rather than private to make the classes more easily extensible by the weekend.

@MarkBaker
Copy link
Member

Unfortunately, that's likely to make it a manual merge :(

@bbrdaric
Copy link

Very nice work, @cifren!

I have cloned your repo and put down one test sample to check how it works.
It seems that rowspan and colspan work fine when alone, but there is a problem when rowspan and colspan are used together.

Consider this table

<table>
    <tr>
        <td colspan="5">1</td>
        <td>2</td>
        <td>3</td>
        <td>4</td>
        <td>5</td>
        <td>6</td>
    </tr>
    <tr>
        <td colspan="5" rowspan="2">7</td>
        <td>8</td>
        <td>9</td>
        <td>10</td>
        <td>11</td>
        <td>12</td>
    </tr>
    <tr>
        <td>13</td>
        <td>14</td>
        <td>15</td>
        <td>16</td>
        <td>17</td>
    </tr>
    <tr>
        <td rowspan="2">18</td>
        <td>19</td>
        <td rowspan="2">20</td>
        <td>21</td>
        <td rowspan="2">22</td>
        <td>23</td>
        <td rowspan="2">24</td>
        <td>25</td>
        <td rowspan="2">26</td>
        <td>27</td>
    </tr>
    <tr>
        <td>28</td>
        <td>29</td>
        <td>30</td>
        <td>31</td>
        <td>32</td>
    </tr>
</table>

test-table

result-table

As you can see, first and third row are okay, but second row isn't. B3:F3 needs to be moved to F3:J3 and A2:B3 needs to be merged to become A2:E3.
Also, Excel 2010 complains about unreadable content when opening generated file.

@cifren
Copy link
Author

cifren commented Jun 20, 2013

I didn't know about 'rowspan and colspan are used together'... and for the issue with Excel 2010, i think i generated files via Excel5 writer and the message diseappeared (if we talk about the same message, 'verify if the file is not corrupted...', same message when you try to open a html file with excel2010).

I'm sorry but i can't modify anymore because i got rid of phpExcel in our project, it was too slow almost 60sec for apply style and write a file with 1 600 lines. Now i'm creating directly XML files for Excel.

I thought it was a better idea to send you the code to improve it, instead of throw it away. ;)

(i'm sorry i also reformated all the code with netbeans... hard merge...)

MarkBaker pushed a commit that referenced this pull request Dec 7, 2014
@MarkBaker
Copy link
Member

Integrated manually for the merge cells, and fixed the issue with rowspan _and_ colspan values for the same cell; thanks for the basic work cifren

@ericpedia
Copy link

Any idea if this can be fixed?

Edit: I interpreted the Travis build fail as meaning @MarkBaker's fix was not merged, but maybe I misread that?

@MarkBaker
Copy link
Member

The travis build fail has nothing to do with this..... a lot of the calculation engine tests fail for various reasons; and while I'm reducing that slowly, it is a slow task.

The fix for rowspan and columnspan has been merged into the develop branch. As far as I'm aware, it's fixed, and there is no further need for me to do anything with it.

@cifren cifren closed this Dec 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants