Pure Go Office Open Library (.xlsx/.docx/.pptx) [AGPLv3]

polaris · · 2364 次点击    
这是一个分享于 的资源,其中的信息可能已经有所发展或是发生改变。
<p>The library is fairly new, but progressing quickly. It takes a different approach from existing Go OOXML libraries by using code generated from the ECMA-376 XSDs to create the XML based types, and wrapping them with a friendlier API. </p> <p>The primary advantages are:</p> <ul> <li>round-tripping of arbitrary docx/xlsx/pptx files without losing content</li> <li>allowing users to bail out to the .X() method on every wrapped type to manipulate the raw OOXML should an API not exist for the functionality that they need. </li> </ul> <p>As an example of the second, if setting a document background is ever requested by a user, we would add a method so that the following worked:</p> <pre><code>dox := document.New() dox.SetBackground(color.RGB(50,50,50)) </code></pre> <p>The user is not stuck though and can always continue making progress with the library as is by falling back to <code>.X()</code>:</p> <pre><code>dox := document.New() doc.X().Background = wordprocessingml.NewCT_Background() doc.X().Background.ColorAttr = &amp;wordprocessingml.ST_HexColor{} doc.X().Background.ColorAttr.ST_HexColorRGB = color.RGB(50, 50, 50).AsRGBString() </code></pre> <p>If you do ever need to resort to OOXML manipulation, please file an issue so we can add an API to cover that use case. The ECMA-376 spec is massive and its hard to tell which parts might be commonly vs rarely used.</p> <p>Regarding current status, DOCX and XLSX work well with development currently being heavy on XLSX with the next major step being adding support for PPTX as soon as the rest of the chart types are added to the spreadsheet package.</p> <p><a href=""></a></p> <hr/>**评论:**<br/><br/>tealeg: <pre><p>FWIW, generating the libraries from the XSDs was something I always planned to do with <a href=""></a> but I never got around to it. Nice to see there are now at least two newer implementations after all these years! </p></pre>kardianos: <pre><p>I appropriate your work! One aspect of Go is that it statically links libraries, and while I appreciate your effort and ownership (along with doing whatever you want with the code), l AGPL is a no-go for many projects (including mine). Many are bound to not even look at AGPL code.</p> <p>However, your description above looks great! Thanks for your hard work.</p></pre>baliance: <pre><p>Thanks! I realize the AGPL isn&#39;t for every circumstance, and we do offer a commercial license without the AGPL restrictions. </p> <p>I also debated between the GPL and AGPL, changing my mind several times in the process. It wouldn&#39;t take much to convince me to change the license to GPL.</p></pre>kardianos: <pre><p>Oh, I missed that in the README.</p> <p>Are you able to advertise the terms of sale? There is a chance I will need an xlsx with chart capabilities in the near future.</p></pre>baliance: <pre><p>PM sent.</p></pre>

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

2364 次点击  
加入收藏 微博
0 回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传