libxlsxwriter 0.7.4 (new formula)
Add a new formula for libxlsxwriter. libxlsxwriter is a C library for writing files in the Excel 2007+ XLSX file format. It can be used to write text, numbers, formulas and hyperlinks to multiple worksheets and it supports features such as formatting, images, charts, page setup and many others. See: https://libxlsxwriter.github.io/index.html Closes #17004. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
parent
15e2b9b33a
commit
a8516a794e
1 changed files with 31 additions and 0 deletions
31
Formula/libxlsxwriter.rb
Normal file
31
Formula/libxlsxwriter.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
class Libxlsxwriter < Formula
|
||||
desc "C library for creating Excel XLSX files"
|
||||
homepage "https://libxlsxwriter.github.io/"
|
||||
url "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_0.7.4.tar.gz"
|
||||
sha256 "4a1143e4d9532468305fe7553792ab01274febdf715175a89c7ab8296378fa14"
|
||||
|
||||
def install
|
||||
system "make", "install", "INSTALL_DIR=#{prefix}", "V=1"
|
||||
end
|
||||
|
||||
test do
|
||||
(testpath/"test.c").write <<-EOS.undent
|
||||
#include "xlsxwriter.h"
|
||||
|
||||
int main() {
|
||||
lxw_workbook *workbook = workbook_new("myexcel.xlsx");
|
||||
lxw_worksheet *worksheet = workbook_add_worksheet(workbook, NULL);
|
||||
int row = 0;
|
||||
int col = 0;
|
||||
|
||||
worksheet_write_string(worksheet, row, col, "Hello me!", NULL);
|
||||
|
||||
return workbook_close(workbook);
|
||||
}
|
||||
EOS
|
||||
|
||||
system ENV.cc, "test.c", "-L#{lib}", "-I#{include}", "-lxlsxwriter", "-o", "test"
|
||||
system "./test"
|
||||
assert_predicate testpath/"myexcel.xlsx", :exist?, "Failed to create xlsx file"
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue