{"action":"created","issue":{"url":"https://api.github.com/repos/box/spout/issues/200","repository_url":"https://api.github.com/repos/box/spout","labels_url":"https://api.github.com/repos/box/spout/issues/200/labels{/name}","comments_url":"https://api.github.com/repos/box/spout/issues/200/comments","events_url":"https://api.github.com/repos/box/spout/issues/200/events","html_url":"https://github.com/box/spout/pull/200","id":148715945,"number":200,"title":"First stab at #135 - Add borders","user":{"login":"madflow","id":183248,"avatar_url":"https://avatars.githubusercontent.com/u/183248?v=3","gravatar_id":"","url":"https://api.github.com/users/madflow","html_url":"https://github.com/madflow","followers_url":"https://api.github.com/users/madflow/followers","following_url":"https://api.github.com/users/madflow/following{/other_user}","gists_url":"https://api.github.com/users/madflow/gists{/gist_id}","starred_url":"https://api.github.com/users/madflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madflow/subscriptions","organizations_url":"https://api.github.com/users/madflow/orgs","repos_url":"https://api.github.com/users/madflow/repos","events_url":"https://api.github.com/users/madflow/events{/privacy}","received_events_url":"https://api.github.com/users/madflow/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-04-15T17:09:14Z","updated_at":"2016-06-17T07:38:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/box/spout/pulls/200","html_url":"https://github.com/box/spout/pull/200","diff_url":"https://github.com/box/spout/pull/200.diff","patch_url":"https://github.com/box/spout/pull/200.patch"},"body":"I tinkered with table cell borders in xlsx and ods and I decided to create this pull request with the result. I have not written any tests yet, because I am not sure if my approach will fit into the existing philosophy how styles are created.\r\n\r\nIn this first pass I decided to support a subset of border styling in xslx and ods. My investigation showed, that xlsx is actually more limited and of course different than ods. In order to serve two masters I tried to find a sane common ground and translate between the two formats.\r\n\r\nThey both have in common, that \r\n\r\n + there are \"Border Parts\"  (```left,right,bottom,top``` in xlsx, ```fo:border-left etc``` in ods)\r\n + there are \"Border Styles\" (```dashed,dotted```)\r\n + there are \"Border Width\" (```thin, medium, thick``` in xlsx and values like ```1.5pt``` in ods) and\r\n + there is a \"Border Color\".\r\n\r\nxlsx does not seem to have a dedicated border width. There are numerous constants like thin, medium, thick (all translate to a \"solid\" border).\r\n\r\nFor example this xlsx:\r\n\r\n```\r\n<border>\r\n  <bottom style=\"thick\"><color rgb=\"FFC000\"/></bottom>\r\n  <right style=\"dashed\"><color rgb=\"00B050\"/></right>\r\n</border>\r\n```\r\n\r\nBasically translates to ods:\r\n\r\n```\r\n<style:table-cell-properties \r\n  fo:border-bottom=\"2.5pt solid #FFC000\" fo:border-right=\"0.75pt dashed #00B050\"\r\n/>\r\n```\r\n\r\nSetting all Border attributes with the Stylebuilder would create a lot of noise - so I decided to create a border object first and than pass it to the builder.\r\n\r\nCreating a border currently looks like this:\r\n\r\n```\r\n$data = [\r\n    ['YO', 'YES', 'JA'],\r\n];\r\n\r\n$data2 = [\r\n    ['NOPE', 'NO', 'NON'],\r\n];\r\n\r\n$border = new Border();\r\n$border\r\n    ->addPart(new BorderPart(Border::BOTTOM, Border::STYLE_SOLID, Border::WIDTH_THICK, Color::ORANGE))\r\n    ->addPart(new BorderPart(Border::RIGHT, Border::STYLE_DASHED, Border::WIDTH_THIN, Color::GREEN));\r\n\r\n$style = (new StyleBuilder())\r\n    ->setBorder($border)\r\n    ->build();\r\n\r\n$writerXlsx = WriterFactory::create(Type::XLSX);\r\n$writerXlsx->openToFile('borders.xlsx');\r\n$writerXlsx->addRowsWithStyle($data, $style);\r\n$writerXlsx->addRows($data2);\r\n$writerXlsx->close();\r\n```\r\n\r\nLet me know what you think."},"comment":{"url":"https://api.github.com/repos/box/spout/issues/comments/226701724","html_url":"https://github.com/box/spout/pull/200#issuecomment-226701724","issue_url":"https://api.github.com/repos/box/spout/issues/200","id":226701724,"user":{"login":"madflow","id":183248,"avatar_url":"https://avatars.githubusercontent.com/u/183248?v=3","gravatar_id":"","url":"https://api.github.com/users/madflow","html_url":"https://github.com/madflow","followers_url":"https://api.github.com/users/madflow/followers","following_url":"https://api.github.com/users/madflow/following{/other_user}","gists_url":"https://api.github.com/users/madflow/gists{/gist_id}","starred_url":"https://api.github.com/users/madflow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madflow/subscriptions","organizations_url":"https://api.github.com/users/madflow/orgs","repos_url":"https://api.github.com/users/madflow/repos","events_url":"https://api.github.com/users/madflow/events{/privacy}","received_events_url":"https://api.github.com/users/madflow/received_events","type":"User","site_admin":false},"created_at":"2016-06-17T07:38:27Z","updated_at":"2016-06-17T07:38:27Z","body":"The thorough QA is one of the reasons we integrated this library in our stack. So no worries about the \"nit picking\" ;)"}}
{"actor":{"display_login":"madflow"}}