xlsxwriter 0.2.1.pre → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +4 -3
- data/ext/xlsxwriter/chart.c +88 -80
- data/ext/xlsxwriter/chart.h +2 -2
- data/ext/xlsxwriter/chartsheet.c +307 -0
- data/ext/xlsxwriter/chartsheet.h +15 -0
- data/ext/xlsxwriter/common.h +104 -0
- data/ext/xlsxwriter/extconf.rb +8 -8
- data/ext/xlsxwriter/libxlsxwriter/License.txt +24 -2
- data/ext/xlsxwriter/libxlsxwriter/Makefile +46 -12
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/app.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chart.h +196 -30
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/chartsheet.h +3 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/comment.h +76 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/common.h +24 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/content_types.h +5 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/core.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/custom.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/drawing.h +6 -17
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/format.h +20 -6
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/hash_table.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/packager.h +3 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/relationships.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/shared_strings.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/styles.h +11 -5
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/theme.h +1 -1
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/third_party/md5.h +43 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/utility.h +42 -3
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/vml.h +55 -0
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/workbook.h +83 -18
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/worksheet.h +1519 -109
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter/xmlwriter.h +4 -2
- data/ext/xlsxwriter/libxlsxwriter/include/xlsxwriter.h +3 -2
- data/ext/xlsxwriter/libxlsxwriter/src/Makefile +25 -7
- data/ext/xlsxwriter/libxlsxwriter/src/app.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/chart.c +332 -48
- data/ext/xlsxwriter/libxlsxwriter/src/chartsheet.c +20 -19
- data/ext/xlsxwriter/libxlsxwriter/src/comment.c +443 -0
- data/ext/xlsxwriter/libxlsxwriter/src/content_types.c +20 -1
- data/ext/xlsxwriter/libxlsxwriter/src/core.c +2 -2
- data/ext/xlsxwriter/libxlsxwriter/src/custom.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/drawing.c +58 -20
- data/ext/xlsxwriter/libxlsxwriter/src/format.c +98 -25
- data/ext/xlsxwriter/libxlsxwriter/src/hash_table.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/packager.c +269 -12
- data/ext/xlsxwriter/libxlsxwriter/src/relationships.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/shared_strings.c +2 -4
- data/ext/xlsxwriter/libxlsxwriter/src/styles.c +334 -48
- data/ext/xlsxwriter/libxlsxwriter/src/theme.c +1 -1
- data/ext/xlsxwriter/libxlsxwriter/src/utility.c +71 -8
- data/ext/xlsxwriter/libxlsxwriter/src/vml.c +1032 -0
- data/ext/xlsxwriter/libxlsxwriter/src/workbook.c +343 -27
- data/ext/xlsxwriter/libxlsxwriter/src/worksheet.c +3759 -478
- data/ext/xlsxwriter/libxlsxwriter/src/xmlwriter.c +81 -2
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/Makefile +42 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.c +291 -0
- data/ext/xlsxwriter/libxlsxwriter/third_party/md5/md5.h +43 -0
- data/ext/xlsxwriter/shared_strings.c +65 -0
- data/ext/xlsxwriter/shared_strings.h +15 -0
- data/ext/xlsxwriter/workbook.c +96 -20
- data/ext/xlsxwriter/worksheet.c +125 -235
- data/ext/xlsxwriter/worksheet.h +2 -1
- data/ext/xlsxwriter/xlsxwriter.c +4 -0
- data/lib/xlsxwriter/rich_string.rb +0 -2
- data/lib/xlsxwriter/version.rb +1 -1
- data/lib/xlsxwriter/worksheet.rb +2 -2
- data/test/{run-test.rb → run_test.rb} +3 -3
- data/test/support/chart_test.rb +3 -3
- data/test/support/with_xlsx_file.rb +4 -2
- data/test/support/xlsx_comparable.rb +40 -26
- data/test/test_array_formula.rb +42 -0
- data/test/test_autofilter.rb +72 -0
- data/test/{test-chart-area.rb → test_chart_area.rb} +2 -2
- data/test/{test-chart-axis.rb → test_chart_axis.rb} +16 -16
- data/test/test_chart_bar.rb +382 -0
- data/test/test_chart_blank.rb +27 -0
- data/test/{test-chart-column.rb → test_chart_column.rb} +2 -2
- data/test/{test-chart-doughnut.rb → test_chart_doughnut.rb} +2 -2
- data/test/{test-chart-legend.rb → test_chart_legend.rb} +2 -2
- data/test/{test-chart-pie.rb → test_chart_pie.rb} +2 -2
- data/test/{test-chart-scatter.rb → test_chart_scatter.rb} +3 -4
- data/test/{test-chart-size.rb → test_chart_size.rb} +2 -2
- data/test/{test-chart-title.rb → test_chart_title.rb} +3 -3
- data/test/test_chartsheet.rb +201 -0
- data/test/{test-data.rb → test_data.rb} +1 -1
- data/test/{test-data-validation.rb → test_data_validation.rb} +23 -24
- data/test/{test-default-row.rb → test_default_row.rb} +1 -1
- data/test/{test-defined-name.rb → test_defined_name.rb} +12 -12
- data/test/{test-escapes.rb → test_escapes.rb} +5 -2
- data/test/{test-fit-to-pages.rb → test_fit_to_pages.rb} +6 -6
- data/test/{test-formatting.rb → test_formatting.rb} +10 -10
- data/test/{test-gridlines.rb → test_gridlines.rb} +3 -3
- data/test/{test-hyperlink.rb → test_hyperlink.rb} +22 -11
- data/test/{test-image.rb → test_image.rb} +6 -4
- data/test/{test-macro.rb → test_macro.rb} +1 -1
- data/test/{test-merge-range.rb → test_merge_range.rb} +1 -1
- data/test/{test-misc.rb → test_misc.rb} +2 -2
- data/test/{test-optimize.rb → test_optimize.rb} +2 -4
- data/test/{test-outline.rb → test_outline.rb} +14 -14
- data/test/{test-page-breaks.rb → test_page_breaks.rb} +2 -2
- data/test/{test-page-setup.rb → test_page_setup.rb} +2 -2
- data/test/{test-panes.rb → test_panes.rb} +1 -1
- data/test/{test-print-area.rb → test_print_area.rb} +3 -3
- data/test/{test-print-options.rb → test_print_options.rb} +7 -7
- data/test/{test-print-scale.rb → test_print_scale.rb} +2 -2
- data/test/{test-properties.rb → test_properties.rb} +2 -2
- data/test/{test-protect.rb → test_protect.rb} +3 -3
- data/test/{test-repeat.rb → test_repeat.rb} +3 -3
- data/test/{test-rich-string.rb → test_rich_string.rb} +5 -9
- data/test/{test-row-col-format.rb → test_row_col_format.rb} +1 -1
- data/test/{test-ruby-worksheet.rb → test_ruby_worksheet.rb} +2 -2
- data/test/{test-set-selection.rb → test_set_selection.rb} +2 -2
- data/test/{test-set-start-page.rb → test_set_start_page.rb} +2 -2
- data/test/{test-simple.rb → test_simple.rb} +10 -10
- data/test/{test-types.rb → test_types.rb} +1 -1
- data/test/{xlsx-func-testcase.rb → xlsx_func_testcase.rb} +1 -0
- metadata +135 -104
- data/test/test-array-formula.rb +0 -35
- data/test/test-autofilter.rb +0 -72
- data/test/test-chart-bar.rb +0 -74
- /data/test/{test-errors.rb → test_errors.rb} +0 -0
data/ext/xlsxwriter/worksheet.c
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#include "chart.h"
|
2
|
+
#include "common.h"
|
2
3
|
#include "rich_string.h"
|
3
4
|
#include "worksheet.h"
|
4
5
|
#include "workbook.h"
|
@@ -10,8 +11,7 @@ void worksheet_free(void *p);
|
|
10
11
|
|
11
12
|
|
12
13
|
VALUE
|
13
|
-
worksheet_alloc(VALUE klass)
|
14
|
-
{
|
14
|
+
worksheet_alloc(VALUE klass) {
|
15
15
|
VALUE obj;
|
16
16
|
struct worksheet *ptr;
|
17
17
|
|
@@ -33,9 +33,8 @@ worksheet_init(int argc, VALUE *argv, VALUE self) {
|
|
33
33
|
|
34
34
|
Data_Get_Struct(self, struct worksheet, ptr);
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
} else if (argc == 2) {
|
36
|
+
rb_check_arity(argc, 1, 2);
|
37
|
+
if (argc == 2) {
|
39
38
|
switch (TYPE(argv[1])) {
|
40
39
|
case T_HASH:
|
41
40
|
opts = argv[1];
|
@@ -120,11 +119,9 @@ worksheet_write_string_(int argc, VALUE *argv, VALUE self) {
|
|
120
119
|
}
|
121
120
|
|
122
121
|
const char *str = StringValueCStr(value);
|
123
|
-
struct worksheet *ptr;
|
124
122
|
VALUE workbook = rb_iv_get(self, "@workbook");
|
125
123
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
126
|
-
|
127
|
-
worksheet_write_string(ptr->worksheet, row, col, str, format);
|
124
|
+
LXW_NO_RESULT_CALL(worksheet, write_string, row, col, str, format);
|
128
125
|
return self;
|
129
126
|
}
|
130
127
|
|
@@ -155,11 +152,9 @@ worksheet_write_number_(int argc, VALUE *argv, VALUE self) {
|
|
155
152
|
}
|
156
153
|
|
157
154
|
const double num = NUM2DBL(value);
|
158
|
-
struct worksheet *ptr;
|
159
155
|
VALUE workbook = rb_iv_get(self, "@workbook");
|
160
156
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
161
|
-
|
162
|
-
worksheet_write_number(ptr->worksheet, row, col, num, format);
|
157
|
+
LXW_NO_RESULT_CALL(worksheet, write_number, row, col, num, format);
|
163
158
|
return self;
|
164
159
|
}
|
165
160
|
|
@@ -190,11 +185,9 @@ worksheet_write_formula_(int argc, VALUE *argv, VALUE self) {
|
|
190
185
|
}
|
191
186
|
|
192
187
|
const char *str = RSTRING_PTR(value);
|
193
|
-
struct worksheet *ptr;
|
194
188
|
VALUE workbook = rb_iv_get(self, "@workbook");
|
195
189
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
196
|
-
|
197
|
-
worksheet_write_formula(ptr->worksheet, row, col, str, format);
|
190
|
+
LXW_NO_RESULT_CALL(worksheet, write_formula, row, col, str, format);
|
198
191
|
return self;
|
199
192
|
}
|
200
193
|
|
@@ -226,11 +219,9 @@ VALUE worksheet_write_array_formula_(int argc, VALUE *argv, VALUE self) {
|
|
226
219
|
++larg;
|
227
220
|
}
|
228
221
|
|
229
|
-
struct worksheet *ptr;
|
230
222
|
VALUE workbook = rb_iv_get(self, "@workbook");
|
231
223
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
232
|
-
|
233
|
-
worksheet_write_array_formula(ptr->worksheet, row_from, col_from, row_to, col_to, str, format);
|
224
|
+
LXW_NO_RESULT_CALL(worksheet, write_array_formula, row_from, col_from, row_to, col_to, str, format);
|
234
225
|
return self;
|
235
226
|
}
|
236
227
|
|
@@ -261,11 +252,9 @@ worksheet_write_datetime_(int argc, VALUE *argv, VALUE self) {
|
|
261
252
|
}
|
262
253
|
|
263
254
|
struct lxw_datetime datetime = value_to_lxw_datetime(value);
|
264
|
-
struct worksheet *ptr;
|
265
255
|
VALUE workbook = rb_iv_get(self, "@workbook");
|
266
256
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
267
|
-
|
268
|
-
worksheet_write_datetime(ptr->worksheet, row, col, &datetime, format);
|
257
|
+
LXW_NO_RESULT_CALL(worksheet, write_datetime, row, col, &datetime, format);
|
269
258
|
return self;
|
270
259
|
}
|
271
260
|
|
@@ -360,11 +349,9 @@ worksheet_write_boolean_(int argc, VALUE *argv, VALUE self) {
|
|
360
349
|
++larg;
|
361
350
|
}
|
362
351
|
|
363
|
-
struct worksheet *ptr;
|
364
352
|
VALUE workbook = rb_iv_get(self, "@workbook");
|
365
353
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
366
|
-
|
367
|
-
worksheet_write_boolean(ptr->worksheet, row, col, bool_value, format);
|
354
|
+
LXW_NO_RESULT_CALL(worksheet, write_boolean, row, col, bool_value, format);
|
368
355
|
return self;
|
369
356
|
}
|
370
357
|
|
@@ -388,11 +375,9 @@ worksheet_write_blank_(int argc, VALUE *argv, VALUE self) {
|
|
388
375
|
++larg;
|
389
376
|
}
|
390
377
|
|
391
|
-
struct worksheet *ptr;
|
392
378
|
VALUE workbook = rb_iv_get(self, "@workbook");
|
393
379
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
394
|
-
|
395
|
-
worksheet_write_blank(ptr->worksheet, row, col, format);
|
380
|
+
LXW_NO_RESULT_CALL(worksheet, write_blank, row, col, format);
|
396
381
|
return self;
|
397
382
|
}
|
398
383
|
|
@@ -429,11 +414,9 @@ worksheet_write_formula_num_(int argc, VALUE *argv, VALUE self) {
|
|
429
414
|
}
|
430
415
|
|
431
416
|
const char *str = RSTRING_PTR(formula);
|
432
|
-
struct worksheet *ptr;
|
433
417
|
VALUE workbook = rb_iv_get(self, "@workbook");
|
434
418
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
435
|
-
|
436
|
-
worksheet_write_formula_num(ptr->worksheet, row, col, str, format, NUM2DBL(value));
|
419
|
+
LXW_NO_RESULT_CALL(worksheet, write_formula_num, row, col, str, format, NUM2DBL(value));
|
437
420
|
return self;
|
438
421
|
}
|
439
422
|
|
@@ -473,13 +456,10 @@ worksheet_write_rich_string_(int argc, VALUE *argv, VALUE self) {
|
|
473
456
|
rb_raise(rb_eArgError, "No value specified");
|
474
457
|
}
|
475
458
|
|
476
|
-
struct worksheet *ptr;
|
477
459
|
lxw_format *format = workbook_get_format(workbook, format_key);
|
478
460
|
lxw_rich_string_tuple **rich_string = serialize_rich_string(value);
|
479
461
|
if (rich_string) {
|
480
|
-
|
481
|
-
lxw_error err = worksheet_write_rich_string(ptr->worksheet, row, col, rich_string, format);
|
482
|
-
handle_lxw_error(err);
|
462
|
+
LXW_ERR_RESULT_CALL(worksheet, write_rich_string, row, col, rich_string, format);
|
483
463
|
}
|
484
464
|
return self;
|
485
465
|
}
|
@@ -684,7 +664,7 @@ worksheet_insert_chart_(int argc, VALUE *argv, VALUE self) {
|
|
684
664
|
lxw_row_t row;
|
685
665
|
lxw_col_t col;
|
686
666
|
VALUE chart, opts = Qnil;
|
687
|
-
|
667
|
+
lxw_chart_options options;
|
688
668
|
char with_options = '\0';
|
689
669
|
|
690
670
|
rb_check_arity(argc, 2, 4);
|
@@ -703,7 +683,7 @@ worksheet_insert_chart_(int argc, VALUE *argv, VALUE self) {
|
|
703
683
|
}
|
704
684
|
|
705
685
|
if (!NIL_P(opts)) {
|
706
|
-
options =
|
686
|
+
options = val_to_lxw_chart_options(opts, &with_options);
|
707
687
|
}
|
708
688
|
|
709
689
|
struct worksheet *ptr;
|
@@ -752,10 +732,7 @@ worksheet_merge_range_(int argc, VALUE *argv, VALUE self) {
|
|
752
732
|
++larg;
|
753
733
|
}
|
754
734
|
|
755
|
-
|
756
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
757
|
-
|
758
|
-
worksheet_merge_range(ptr->worksheet, row1, col1, row2, col2, str, format);
|
735
|
+
LXW_NO_RESULT_CALL(worksheet, merge_range, row1, col1, row2, col2, str, format);
|
759
736
|
return self;
|
760
737
|
}
|
761
738
|
|
@@ -778,10 +755,7 @@ worksheet_autofilter_(int argc, VALUE *argv, VALUE self) {
|
|
778
755
|
rb_check_arity(argc, 1, 4);
|
779
756
|
extract_range(argc, argv, &row_from, &col_from, &row_to, &col_to);
|
780
757
|
|
781
|
-
|
782
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
783
|
-
|
784
|
-
worksheet_autofilter(ptr->worksheet, row_from, col_from, row_to, col_to);
|
758
|
+
LXW_NO_RESULT_CALL(worksheet, autofilter, row_from, col_from, row_to, col_to);
|
785
759
|
return self;
|
786
760
|
}
|
787
761
|
|
@@ -791,21 +765,17 @@ worksheet_autofilter_(int argc, VALUE *argv, VALUE self) {
|
|
791
765
|
*/
|
792
766
|
VALUE
|
793
767
|
worksheet_activate_(VALUE self) {
|
794
|
-
|
795
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
796
|
-
worksheet_activate(ptr->worksheet);
|
768
|
+
LXW_NO_RESULT_CALL(worksheet, activate);
|
797
769
|
return self;
|
798
770
|
}
|
799
771
|
|
800
772
|
/* call-seq: ws.select -> self
|
801
773
|
*
|
802
|
-
* Set the worksheet to be selected on
|
774
|
+
* Set the worksheet to be selected on opening the workbook.
|
803
775
|
*/
|
804
776
|
VALUE
|
805
777
|
worksheet_select_(VALUE self) {
|
806
|
-
|
807
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
808
|
-
worksheet_select(ptr->worksheet);
|
778
|
+
LXW_NO_RESULT_CALL(worksheet, select);
|
809
779
|
return self;
|
810
780
|
}
|
811
781
|
|
@@ -815,9 +785,7 @@ worksheet_select_(VALUE self) {
|
|
815
785
|
*/
|
816
786
|
VALUE
|
817
787
|
worksheet_hide_(VALUE self) {
|
818
|
-
|
819
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
820
|
-
worksheet_hide(ptr->worksheet);
|
788
|
+
LXW_NO_RESULT_CALL(worksheet, hide);
|
821
789
|
return self;
|
822
790
|
}
|
823
791
|
|
@@ -828,9 +796,7 @@ worksheet_hide_(VALUE self) {
|
|
828
796
|
*/
|
829
797
|
VALUE
|
830
798
|
worksheet_set_first_sheet_(VALUE self) {
|
831
|
-
|
832
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
833
|
-
worksheet_set_first_sheet(ptr->worksheet);
|
799
|
+
LXW_NO_RESULT_CALL(worksheet, set_first_sheet);
|
834
800
|
return self;
|
835
801
|
}
|
836
802
|
|
@@ -876,9 +842,7 @@ worksheet_freeze_panes_(int argc, VALUE *argv, VALUE self) {
|
|
876
842
|
*/
|
877
843
|
VALUE
|
878
844
|
worksheet_split_panes_(VALUE self, VALUE vertical, VALUE horizontal) {
|
879
|
-
|
880
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
881
|
-
worksheet_split_panes(ptr->worksheet, NUM2DBL(vertical), NUM2DBL(horizontal));
|
845
|
+
LXW_NO_RESULT_CALL(worksheet, split_panes, NUM2DBL(vertical), NUM2DBL(horizontal));
|
882
846
|
return self;
|
883
847
|
}
|
884
848
|
|
@@ -901,10 +865,7 @@ worksheet_set_selection_(int argc, VALUE *argv, VALUE self) {
|
|
901
865
|
rb_check_arity(argc, 1, 4);
|
902
866
|
extract_range(argc, argv, &row_from, &col_from, &row_to, &col_to);
|
903
867
|
|
904
|
-
|
905
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
906
|
-
|
907
|
-
worksheet_set_selection(ptr->worksheet, row_from, col_from, row_to, col_to);
|
868
|
+
LXW_NO_RESULT_CALL(worksheet, set_selection, row_from, col_from, row_to, col_to);
|
908
869
|
return self;
|
909
870
|
}
|
910
871
|
|
@@ -914,9 +875,7 @@ worksheet_set_selection_(int argc, VALUE *argv, VALUE self) {
|
|
914
875
|
*/
|
915
876
|
VALUE
|
916
877
|
worksheet_set_landscape_(VALUE self) {
|
917
|
-
|
918
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
919
|
-
worksheet_set_landscape(ptr->worksheet);
|
878
|
+
LXW_NO_RESULT_CALL(worksheet, set_landscape);
|
920
879
|
return self;
|
921
880
|
}
|
922
881
|
|
@@ -926,9 +885,7 @@ worksheet_set_landscape_(VALUE self) {
|
|
926
885
|
*/
|
927
886
|
VALUE
|
928
887
|
worksheet_set_portrait_(VALUE self) {
|
929
|
-
|
930
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
931
|
-
worksheet_set_portrait(ptr->worksheet);
|
888
|
+
LXW_NO_RESULT_CALL(worksheet, set_portrait);
|
932
889
|
return self;
|
933
890
|
}
|
934
891
|
|
@@ -938,9 +895,7 @@ worksheet_set_portrait_(VALUE self) {
|
|
938
895
|
*/
|
939
896
|
VALUE
|
940
897
|
worksheet_set_page_view_(VALUE self) {
|
941
|
-
|
942
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
943
|
-
worksheet_set_page_view(ptr->worksheet);
|
898
|
+
LXW_NO_RESULT_CALL(worksheet, set_page_view);
|
944
899
|
return self;
|
945
900
|
}
|
946
901
|
|
@@ -950,22 +905,18 @@ worksheet_set_page_view_(VALUE self) {
|
|
950
905
|
*/
|
951
906
|
VALUE
|
952
907
|
worksheet_set_paper_(VALUE self, VALUE paper_type) {
|
953
|
-
|
954
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
955
|
-
worksheet_set_paper(ptr->worksheet, NUM2INT(paper_type));
|
908
|
+
LXW_NO_RESULT_CALL(worksheet, set_paper, NUM2INT(paper_type));
|
956
909
|
return self;
|
957
910
|
}
|
958
911
|
|
959
912
|
/* Sets the worksheet margins (Numeric) for the printed page. */
|
960
913
|
VALUE
|
961
914
|
worksheet_set_margins_(VALUE self, VALUE left, VALUE right, VALUE top, VALUE bottom) {
|
962
|
-
|
963
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
964
|
-
worksheet_set_margins(ptr->worksheet, NUM2DBL(left), NUM2DBL(right), NUM2DBL(top), NUM2DBL(bottom));
|
915
|
+
LXW_NO_RESULT_CALL(worksheet, set_margins, NUM2DBL(left), NUM2DBL(right), NUM2DBL(top), NUM2DBL(bottom));
|
965
916
|
return self;
|
966
917
|
}
|
967
918
|
|
968
|
-
/* call-seq: ws.set_header(text, opts) -> self
|
919
|
+
/* call-seq: ws.set_header(text[, opts]) -> self
|
969
920
|
*
|
970
921
|
* See {libxlsxwriter doc}[https://libxlsxwriter.github.io/worksheet_8h.html#a4070c24ed5107f33e94f30a1bf865ba9]
|
971
922
|
* for the +text+ control characters.
|
@@ -973,24 +924,18 @@ worksheet_set_margins_(VALUE self, VALUE left, VALUE right, VALUE top, VALUE bot
|
|
973
924
|
* Currently the only supported option is +:margin+ (Numeric).
|
974
925
|
*/
|
975
926
|
VALUE
|
976
|
-
worksheet_set_header_(
|
977
|
-
|
978
|
-
|
979
|
-
char with_options = '\0';
|
980
|
-
if (!NIL_P(opts)) {
|
981
|
-
VALUE margin = rb_hash_aref(opts, ID2SYM(rb_intern("margin")));
|
982
|
-
if (!NIL_P(margin)) {
|
983
|
-
with_options = '\1';
|
984
|
-
options.margin = NUM2DBL(margin);
|
985
|
-
}
|
986
|
-
}
|
927
|
+
worksheet_set_header_(int argc, VALUE *argv, VALUE self) {
|
928
|
+
rb_check_arity(argc, 1, 2);
|
929
|
+
struct _header_options ho = _extract_header_options(argc, argv);
|
987
930
|
struct worksheet *ptr;
|
988
931
|
Data_Get_Struct(self, struct worksheet, ptr);
|
989
|
-
|
990
|
-
|
932
|
+
lxw_error err;
|
933
|
+
if (!ho.with_options) {
|
934
|
+
err = worksheet_set_header(ptr->worksheet, ho.str);
|
991
935
|
} else {
|
992
|
-
worksheet_set_header_opt(ptr->worksheet, str, &options);
|
936
|
+
err = worksheet_set_header_opt(ptr->worksheet, ho.str, &ho.options);
|
993
937
|
}
|
938
|
+
handle_lxw_error(err);
|
994
939
|
return self;
|
995
940
|
}
|
996
941
|
|
@@ -999,24 +944,18 @@ worksheet_set_header_(VALUE self, VALUE val, VALUE opts) {
|
|
999
944
|
* See #set_header for params description.
|
1000
945
|
*/
|
1001
946
|
VALUE
|
1002
|
-
worksheet_set_footer_(
|
1003
|
-
const char *str = StringValueCStr(val);
|
1004
|
-
lxw_header_footer_options options = { .margin = 0.0 };
|
1005
|
-
char with_options = '\0';
|
1006
|
-
if (!NIL_P(opts)) {
|
1007
|
-
VALUE margin = rb_hash_aref(opts, ID2SYM(rb_intern("margin")));
|
1008
|
-
if (!NIL_P(margin)) {
|
1009
|
-
with_options = '\1';
|
1010
|
-
options.margin = NUM2DBL(margin);
|
1011
|
-
}
|
1012
|
-
}
|
947
|
+
worksheet_set_footer_(int argc, VALUE *argv, VALUE self) {
|
1013
948
|
struct worksheet *ptr;
|
949
|
+
rb_check_arity(argc, 1, 2);
|
950
|
+
struct _header_options ho = _extract_header_options(argc, argv);
|
1014
951
|
Data_Get_Struct(self, struct worksheet, ptr);
|
1015
|
-
|
1016
|
-
|
952
|
+
lxw_error err;
|
953
|
+
if (!ho.with_options) {
|
954
|
+
err = worksheet_set_footer(ptr->worksheet, ho.str);
|
1017
955
|
} else {
|
1018
|
-
worksheet_set_footer_opt(ptr->worksheet, str, &options);
|
956
|
+
err = worksheet_set_footer_opt(ptr->worksheet, ho.str, &ho.options);
|
1019
957
|
}
|
958
|
+
handle_lxw_error(err);
|
1020
959
|
return self;
|
1021
960
|
}
|
1022
961
|
|
@@ -1035,9 +974,7 @@ worksheet_set_h_pagebreaks_(VALUE self, VALUE val) {
|
|
1035
974
|
rows[i] = NUM2INT(rb_ary_entry(val, i));
|
1036
975
|
}
|
1037
976
|
rows[len] = 0;
|
1038
|
-
|
1039
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1040
|
-
worksheet_set_h_pagebreaks(ptr->worksheet, rows);
|
977
|
+
LXW_NO_RESULT_CALL(worksheet, set_h_pagebreaks, rows);
|
1041
978
|
return val;
|
1042
979
|
}
|
1043
980
|
|
@@ -1056,18 +993,14 @@ worksheet_set_v_pagebreaks_(VALUE self, VALUE val) {
|
|
1056
993
|
cols[i] = value_to_col(rb_ary_entry(val, i));
|
1057
994
|
}
|
1058
995
|
cols[len] = 0;
|
1059
|
-
|
1060
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1061
|
-
worksheet_set_v_pagebreaks(ptr->worksheet, cols);
|
996
|
+
LXW_NO_RESULT_CALL(worksheet, set_v_pagebreaks, cols);
|
1062
997
|
return val;
|
1063
998
|
}
|
1064
999
|
|
1065
1000
|
/* Changes the default print direction */
|
1066
1001
|
VALUE
|
1067
1002
|
worksheet_print_across_(VALUE self) {
|
1068
|
-
|
1069
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1070
|
-
worksheet_print_across(ptr->worksheet);
|
1003
|
+
LXW_NO_RESULT_CALL(worksheet, print_across);
|
1071
1004
|
return self;
|
1072
1005
|
}
|
1073
1006
|
|
@@ -1077,9 +1010,7 @@ worksheet_print_across_(VALUE self) {
|
|
1077
1010
|
*/
|
1078
1011
|
VALUE
|
1079
1012
|
worksheet_set_zoom_(VALUE self, VALUE val) {
|
1080
|
-
|
1081
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1082
|
-
worksheet_set_zoom(ptr->worksheet, NUM2INT(val));
|
1013
|
+
LXW_NO_RESULT_CALL(worksheet, set_zoom, NUM2INT(val));
|
1083
1014
|
return self;
|
1084
1015
|
}
|
1085
1016
|
|
@@ -1091,38 +1022,28 @@ worksheet_set_zoom_(VALUE self, VALUE val) {
|
|
1091
1022
|
*/
|
1092
1023
|
VALUE
|
1093
1024
|
worksheet_gridlines_(VALUE self, VALUE value) {
|
1094
|
-
|
1095
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1096
|
-
|
1097
|
-
worksheet_gridlines(ptr->worksheet, NUM2INT(value));
|
1098
|
-
|
1025
|
+
LXW_NO_RESULT_CALL(worksheet, gridlines, NUM2INT(value));
|
1099
1026
|
return value;
|
1100
1027
|
}
|
1101
1028
|
|
1102
1029
|
/* Center the worksheet data horizontally between the margins on the printed page */
|
1103
1030
|
VALUE
|
1104
1031
|
worksheet_center_horizontally_(VALUE self){
|
1105
|
-
|
1106
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1107
|
-
worksheet_center_horizontally(ptr->worksheet);
|
1032
|
+
LXW_NO_RESULT_CALL(worksheet, center_horizontally);
|
1108
1033
|
return self;
|
1109
1034
|
}
|
1110
1035
|
|
1111
1036
|
/* Center the worksheet data vertically between the margins on the printed page */
|
1112
1037
|
VALUE
|
1113
1038
|
worksheet_center_vertically_(VALUE self) {
|
1114
|
-
|
1115
|
-
|
1116
|
-
worksheet_center_vertically(ptr->worksheet);
|
1117
|
-
return self;
|
1039
|
+
LXW_NO_RESULT_CALL(worksheet, center_vertically);
|
1040
|
+
return self;
|
1118
1041
|
}
|
1119
1042
|
|
1120
1043
|
/* Print rows and column header (wich is disabled by default). */
|
1121
1044
|
VALUE
|
1122
1045
|
worksheet_print_row_col_headers_(VALUE self) {
|
1123
|
-
|
1124
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1125
|
-
worksheet_print_row_col_headers(ptr->worksheet);
|
1046
|
+
LXW_NO_RESULT_CALL(worksheet, print_row_col_headers);
|
1126
1047
|
return self;
|
1127
1048
|
}
|
1128
1049
|
|
@@ -1132,9 +1053,7 @@ worksheet_print_row_col_headers_(VALUE self) {
|
|
1132
1053
|
*/
|
1133
1054
|
VALUE
|
1134
1055
|
worksheet_repeat_rows_(VALUE self, VALUE row_from, VALUE row_to) {
|
1135
|
-
|
1136
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1137
|
-
worksheet_repeat_rows(ptr->worksheet, NUM2INT(row_from), NUM2INT(row_to));
|
1056
|
+
LXW_NO_RESULT_CALL(worksheet, repeat_rows, NUM2INT(row_from), NUM2INT(row_to));
|
1138
1057
|
return self;
|
1139
1058
|
}
|
1140
1059
|
|
@@ -1144,9 +1063,7 @@ worksheet_repeat_rows_(VALUE self, VALUE row_from, VALUE row_to) {
|
|
1144
1063
|
*/
|
1145
1064
|
VALUE
|
1146
1065
|
worksheet_repeat_columns_(VALUE self, VALUE col_from, VALUE col_to) {
|
1147
|
-
|
1148
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1149
|
-
worksheet_repeat_columns(ptr->worksheet, value_to_col(col_from), value_to_col(col_to));
|
1066
|
+
LXW_NO_RESULT_CALL(worksheet, repeat_columns, value_to_col(col_from), value_to_col(col_to));
|
1150
1067
|
return self;
|
1151
1068
|
}
|
1152
1069
|
|
@@ -1165,10 +1082,7 @@ worksheet_print_area_(int argc, VALUE *argv, VALUE self) {
|
|
1165
1082
|
rb_check_arity(argc, 1, 4);
|
1166
1083
|
extract_range(argc, argv, &row_from, &col_from, &row_to, &col_to);
|
1167
1084
|
|
1168
|
-
|
1169
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1170
|
-
|
1171
|
-
worksheet_print_area(ptr->worksheet, row_from, col_from, row_to, col_to);
|
1085
|
+
LXW_NO_RESULT_CALL(worksheet, print_area, row_from, col_from, row_to, col_to);
|
1172
1086
|
return self;
|
1173
1087
|
}
|
1174
1088
|
|
@@ -1179,9 +1093,7 @@ worksheet_print_area_(int argc, VALUE *argv, VALUE self) {
|
|
1179
1093
|
*/
|
1180
1094
|
VALUE
|
1181
1095
|
worksheet_fit_to_pages_(VALUE self, VALUE width, VALUE height) {
|
1182
|
-
|
1183
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1184
|
-
worksheet_fit_to_pages(ptr->worksheet, NUM2INT(width), NUM2INT(height));
|
1096
|
+
LXW_NO_RESULT_CALL(worksheet, fit_to_pages, NUM2INT(width), NUM2INT(height));
|
1185
1097
|
return self;
|
1186
1098
|
}
|
1187
1099
|
|
@@ -1191,9 +1103,7 @@ worksheet_fit_to_pages_(VALUE self, VALUE width, VALUE height) {
|
|
1191
1103
|
*/
|
1192
1104
|
VALUE
|
1193
1105
|
worksheet_set_start_page_(VALUE self, VALUE start_page) {
|
1194
|
-
|
1195
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1196
|
-
worksheet_set_start_page(ptr->worksheet, NUM2INT(start_page));
|
1106
|
+
LXW_NO_RESULT_CALL(worksheet, set_start_page, NUM2INT(start_page));
|
1197
1107
|
return start_page;
|
1198
1108
|
}
|
1199
1109
|
|
@@ -1203,27 +1113,21 @@ worksheet_set_start_page_(VALUE self, VALUE start_page) {
|
|
1203
1113
|
*/
|
1204
1114
|
VALUE
|
1205
1115
|
worksheet_set_print_scale_(VALUE self, VALUE scale) {
|
1206
|
-
|
1207
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1208
|
-
worksheet_set_print_scale(ptr->worksheet, NUM2INT(scale));
|
1116
|
+
LXW_NO_RESULT_CALL(worksheet, set_print_scale, NUM2INT(scale));
|
1209
1117
|
return scale;
|
1210
1118
|
}
|
1211
1119
|
|
1212
1120
|
/* Sets text direction to rtl (e.g. for worksheets on Hebrew or Arabic). */
|
1213
1121
|
VALUE
|
1214
1122
|
worksheet_right_to_left_(VALUE self) {
|
1215
|
-
|
1216
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1217
|
-
worksheet_right_to_left(ptr->worksheet);
|
1123
|
+
LXW_NO_RESULT_CALL(worksheet, right_to_left);
|
1218
1124
|
return self;
|
1219
1125
|
}
|
1220
1126
|
|
1221
1127
|
/* Hides all zero values. */
|
1222
1128
|
VALUE
|
1223
1129
|
worksheet_hide_zero_(VALUE self) {
|
1224
|
-
|
1225
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1226
|
-
worksheet_hide_zero(ptr->worksheet);
|
1130
|
+
LXW_NO_RESULT_CALL(worksheet, hide_zero);
|
1227
1131
|
return self;
|
1228
1132
|
}
|
1229
1133
|
|
@@ -1235,9 +1139,7 @@ worksheet_hide_zero_(VALUE self) {
|
|
1235
1139
|
*/
|
1236
1140
|
VALUE
|
1237
1141
|
worksheet_set_tab_color_(VALUE self, VALUE color) {
|
1238
|
-
|
1239
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1240
|
-
worksheet_set_tab_color(ptr->worksheet, NUM2INT(color));
|
1142
|
+
LXW_NO_RESULT_CALL(worksheet, set_tab_color, NUM2INT(color));
|
1241
1143
|
return color;
|
1242
1144
|
}
|
1243
1145
|
|
@@ -1250,65 +1152,8 @@ worksheet_set_tab_color_(VALUE self, VALUE color) {
|
|
1250
1152
|
VALUE
|
1251
1153
|
worksheet_protect_(int argc, VALUE *argv, VALUE self) {
|
1252
1154
|
rb_check_arity(argc, 0, 2);
|
1253
|
-
|
1254
|
-
|
1255
|
-
VALUE opts = Qnil;
|
1256
|
-
// All options are off by default
|
1257
|
-
lxw_protection options = {};
|
1258
|
-
const char *password = NULL;
|
1259
|
-
if (argc > 0 && !NIL_P(argv[0])) {
|
1260
|
-
switch (TYPE(argv[0])) {
|
1261
|
-
case T_STRING:
|
1262
|
-
password = StringValueCStr(argv[0]);
|
1263
|
-
break;
|
1264
|
-
case T_HASH:
|
1265
|
-
opts = argv[0];
|
1266
|
-
break;
|
1267
|
-
default:
|
1268
|
-
rb_raise(rb_eArgError, "Wrong argument %"PRIsVALUE", expected a String or Hash", rb_obj_class(argv[0]));
|
1269
|
-
}
|
1270
|
-
}
|
1271
|
-
|
1272
|
-
if (argc > 1) {
|
1273
|
-
if (TYPE(argv[1]) == T_HASH) {
|
1274
|
-
opts = argv[1];
|
1275
|
-
} else {
|
1276
|
-
rb_raise(rb_eArgError, "Expected a Hash, but got %"PRIsVALUE, rb_obj_class(argv[1]));
|
1277
|
-
}
|
1278
|
-
}
|
1279
|
-
|
1280
|
-
if (!NIL_P(opts)) {
|
1281
|
-
#define PR_OPT(field) { \
|
1282
|
-
val = rb_hash_aref(opts, ID2SYM(rb_intern(#field))); \
|
1283
|
-
if (!NIL_P(val) && val) { \
|
1284
|
-
options.field = 1; \
|
1285
|
-
with_options = 1; \
|
1286
|
-
} \
|
1287
|
-
}
|
1288
|
-
PR_OPT(no_select_locked_cells);
|
1289
|
-
PR_OPT(no_select_unlocked_cells);
|
1290
|
-
PR_OPT(format_cells);
|
1291
|
-
PR_OPT(format_columns);
|
1292
|
-
PR_OPT(format_rows);
|
1293
|
-
PR_OPT(insert_columns);
|
1294
|
-
PR_OPT(insert_rows);
|
1295
|
-
PR_OPT(insert_hyperlinks);
|
1296
|
-
PR_OPT(delete_columns);
|
1297
|
-
PR_OPT(delete_rows);
|
1298
|
-
PR_OPT(sort);
|
1299
|
-
PR_OPT(autofilter);
|
1300
|
-
PR_OPT(pivot_tables);
|
1301
|
-
PR_OPT(scenarios);
|
1302
|
-
PR_OPT(objects);
|
1303
|
-
#undef PR_OPT
|
1304
|
-
}
|
1305
|
-
struct worksheet *ptr;
|
1306
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1307
|
-
if (with_options) {
|
1308
|
-
worksheet_protect(ptr->worksheet, password, &options);
|
1309
|
-
} else {
|
1310
|
-
worksheet_protect(ptr->worksheet, password, NULL);
|
1311
|
-
}
|
1155
|
+
struct _protect_options po = _extract_protect_options(argc, argv);
|
1156
|
+
LXW_NO_RESULT_CALL(worksheet, protect, po.password, (po.with_options ? &po.options : NULL));
|
1312
1157
|
return self;
|
1313
1158
|
}
|
1314
1159
|
|
@@ -1318,8 +1163,6 @@ worksheet_protect_(int argc, VALUE *argv, VALUE self) {
|
|
1318
1163
|
*/
|
1319
1164
|
VALUE
|
1320
1165
|
worksheet_outline_settings_(VALUE self, VALUE opts) {
|
1321
|
-
struct worksheet *ptr;
|
1322
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1323
1166
|
VALUE value;
|
1324
1167
|
#define parse_param(name, default) \
|
1325
1168
|
value = rb_hash_aref(opts, ID2SYM(rb_intern(#name))); \
|
@@ -1329,7 +1172,7 @@ worksheet_outline_settings_(VALUE self, VALUE opts) {
|
|
1329
1172
|
parse_param(symbols_right, LXW_TRUE);
|
1330
1173
|
parse_param(auto_style, LXW_FALSE);
|
1331
1174
|
#undef parse_param
|
1332
|
-
|
1175
|
+
LXW_NO_RESULT_CALL(worksheet, outline_settings, visible, symbols_below, symbols_right, auto_style);
|
1333
1176
|
return self;
|
1334
1177
|
}
|
1335
1178
|
|
@@ -1339,13 +1182,34 @@ worksheet_outline_settings_(VALUE self, VALUE opts) {
|
|
1339
1182
|
*/
|
1340
1183
|
VALUE
|
1341
1184
|
worksheet_set_default_row_(VALUE self, VALUE height, VALUE hide_unused_rows) {
|
1342
|
-
struct worksheet *ptr;
|
1343
1185
|
uint8_t hide_ur = !NIL_P(hide_unused_rows) && hide_unused_rows != Qfalse ? 1 : 0;
|
1344
|
-
|
1345
|
-
worksheet_set_default_row(ptr->worksheet, NUM2DBL(height), hide_ur);
|
1186
|
+
LXW_NO_RESULT_CALL(worksheet, set_default_row, NUM2DBL(height), hide_ur);
|
1346
1187
|
return self;
|
1347
1188
|
}
|
1348
1189
|
|
1190
|
+
/* call-seq: ws.horizontal_dpi -> int
|
1191
|
+
*
|
1192
|
+
* Returns the horizontal dpi.
|
1193
|
+
*/
|
1194
|
+
VALUE
|
1195
|
+
worksheet_get_horizontal_dpi_(VALUE self) {
|
1196
|
+
struct worksheet *ptr;
|
1197
|
+
Data_Get_Struct(self, struct worksheet, ptr);
|
1198
|
+
return INT2NUM(ptr->worksheet->horizontal_dpi);
|
1199
|
+
}
|
1200
|
+
|
1201
|
+
/* call-seq: ws.horizontal_dpi=(dpi) -> dpi
|
1202
|
+
*
|
1203
|
+
* Sets the horizontal dpi.
|
1204
|
+
*/
|
1205
|
+
VALUE
|
1206
|
+
worksheet_set_horizontal_dpi_(VALUE self, VALUE val) {
|
1207
|
+
struct worksheet *ptr;
|
1208
|
+
Data_Get_Struct(self, struct worksheet, ptr);
|
1209
|
+
ptr->worksheet->horizontal_dpi = NUM2INT(val);
|
1210
|
+
return val;
|
1211
|
+
}
|
1212
|
+
|
1349
1213
|
/* call-seq: ws.vertical_dpi -> int
|
1350
1214
|
*
|
1351
1215
|
* Returns the vertical dpi.
|
@@ -1538,12 +1402,7 @@ worksheet_data_validation_(int argc, VALUE *argv, VALUE self) {
|
|
1538
1402
|
*/
|
1539
1403
|
VALUE
|
1540
1404
|
worksheet_set_vba_name_(VALUE self, VALUE name) {
|
1541
|
-
|
1542
|
-
Data_Get_Struct(self, struct worksheet, ptr);
|
1543
|
-
|
1544
|
-
lxw_error err = worksheet_set_vba_name(ptr->worksheet, StringValueCStr(name));
|
1545
|
-
handle_lxw_error(err);
|
1546
|
-
|
1405
|
+
LXW_ERR_RESULT_CALL(worksheet, set_vba_name, StringValueCStr(name));
|
1547
1406
|
return name;
|
1548
1407
|
}
|
1549
1408
|
|
@@ -1649,6 +1508,25 @@ int extract_range(int argc, VALUE *argv, lxw_row_t *row_from, lxw_col_t *col_fro
|
|
1649
1508
|
setter; \
|
1650
1509
|
} \
|
1651
1510
|
}
|
1511
|
+
lxw_chart_options
|
1512
|
+
val_to_lxw_chart_options(VALUE opts, char *with_options) {
|
1513
|
+
VALUE val;
|
1514
|
+
lxw_chart_options options = {
|
1515
|
+
.x_offset = 0,
|
1516
|
+
.y_offset = 0,
|
1517
|
+
.x_scale = 1.0,
|
1518
|
+
.y_scale = 1.0
|
1519
|
+
};
|
1520
|
+
SET_IMG_OPT("offset", options.x_offset = options.y_offset = NUM2INT(val));
|
1521
|
+
SET_IMG_OPT("x_offset", options.x_offset = NUM2INT(val));
|
1522
|
+
SET_IMG_OPT("y_offset", options.y_offset = NUM2INT(val));
|
1523
|
+
SET_IMG_OPT("scale", options.x_scale = options.y_scale = NUM2DBL(val));
|
1524
|
+
SET_IMG_OPT("x_scale", options.x_scale = NUM2DBL(val));
|
1525
|
+
SET_IMG_OPT("y_scale", options.y_scale = NUM2DBL(val));
|
1526
|
+
SET_IMG_OPT("object_position", options.object_position = NUM2INT(val));
|
1527
|
+
return options;
|
1528
|
+
}
|
1529
|
+
|
1652
1530
|
lxw_image_options
|
1653
1531
|
val_to_lxw_image_options(VALUE opts, char *with_options) {
|
1654
1532
|
VALUE val;
|
@@ -1664,7 +1542,10 @@ val_to_lxw_image_options(VALUE opts, char *with_options) {
|
|
1664
1542
|
SET_IMG_OPT("scale", options.x_scale = options.y_scale = NUM2DBL(val));
|
1665
1543
|
SET_IMG_OPT("x_scale", options.x_scale = NUM2DBL(val));
|
1666
1544
|
SET_IMG_OPT("y_scale", options.y_scale = NUM2DBL(val));
|
1545
|
+
SET_IMG_OPT("object_position", options.object_position = NUM2INT(val));
|
1667
1546
|
SET_IMG_OPT("description", options.description = StringValueCStr(val));
|
1547
|
+
SET_IMG_OPT("url", options.url = StringValueCStr(val));
|
1548
|
+
SET_IMG_OPT("tip", options.tip = StringValueCStr(val));
|
1668
1549
|
return options;
|
1669
1550
|
}
|
1670
1551
|
#undef SET_IMG_OPT
|
@@ -1676,6 +1557,7 @@ init_xlsxwriter_worksheet() {
|
|
1676
1557
|
cWorksheet = rb_define_class_under(mXlsxWriter, "Worksheet", rb_cObject);
|
1677
1558
|
|
1678
1559
|
rb_define_alloc_func(cWorksheet, worksheet_alloc);
|
1560
|
+
rb_define_attr(cWorksheet, "workbook", 1, 0);
|
1679
1561
|
rb_define_method(cWorksheet, "initialize", worksheet_init, -1);
|
1680
1562
|
rb_define_method(cWorksheet, "free", worksheet_release, 0);
|
1681
1563
|
rb_define_method(cWorksheet, "write_string", worksheet_write_string_, -1);
|
@@ -1707,8 +1589,8 @@ init_xlsxwriter_worksheet() {
|
|
1707
1589
|
rb_define_method(cWorksheet, "set_page_view", worksheet_set_page_view_, 0);
|
1708
1590
|
rb_define_method(cWorksheet, "paper=", worksheet_set_paper_, 1);
|
1709
1591
|
rb_define_method(cWorksheet, "set_margins", worksheet_set_margins_, 4);
|
1710
|
-
rb_define_method(cWorksheet, "set_header", worksheet_set_header_, 1);
|
1711
|
-
rb_define_method(cWorksheet, "set_footer", worksheet_set_footer_, 1);
|
1592
|
+
rb_define_method(cWorksheet, "set_header", worksheet_set_header_, -1);
|
1593
|
+
rb_define_method(cWorksheet, "set_footer", worksheet_set_footer_, -1);
|
1712
1594
|
rb_define_method(cWorksheet, "h_pagebreaks=", worksheet_set_h_pagebreaks_, 1);
|
1713
1595
|
rb_define_method(cWorksheet, "v_pagebreaks=", worksheet_set_v_pagebreaks_, 1);
|
1714
1596
|
rb_define_method(cWorksheet, "print_across", worksheet_print_across_, 0);
|
@@ -1730,6 +1612,8 @@ init_xlsxwriter_worksheet() {
|
|
1730
1612
|
rb_define_method(cWorksheet, "outline_settings=", worksheet_outline_settings_, 1);
|
1731
1613
|
rb_define_method(cWorksheet, "set_default_row", worksheet_set_default_row_, 2);
|
1732
1614
|
|
1615
|
+
rb_define_method(cWorksheet, "horizontal_dpi", worksheet_get_horizontal_dpi_, 0);
|
1616
|
+
rb_define_method(cWorksheet, "horizontal_dpi=", worksheet_set_horizontal_dpi_, 1);
|
1733
1617
|
rb_define_method(cWorksheet, "vertical_dpi", worksheet_get_vertical_dpi_, 0);
|
1734
1618
|
rb_define_method(cWorksheet, "vertical_dpi=", worksheet_set_vertical_dpi_, 1);
|
1735
1619
|
|
@@ -1771,6 +1655,12 @@ init_xlsxwriter_worksheet() {
|
|
1771
1655
|
MAP_LXW_WH_CONST1(VALIDATION_CRITERIA_LESS_THAN);
|
1772
1656
|
MAP_LXW_WH_CONST1(VALIDATION_CRITERIA_GREATER_THAN_OR_EQUAL_TO);
|
1773
1657
|
MAP_LXW_WH_CONST1(VALIDATION_CRITERIA_LESS_THAN_OR_EQUAL_TO);
|
1658
|
+
|
1659
|
+
MAP_LXW_WH_CONST1(OBJECT_POSITION_DEFAULT);
|
1660
|
+
MAP_LXW_WH_CONST1(OBJECT_MOVE_AND_SIZE);
|
1661
|
+
MAP_LXW_WH_CONST1(OBJECT_MOVE_DONT_SIZE);
|
1662
|
+
MAP_LXW_WH_CONST1(OBJECT_DONT_MOVE_DONT_SIZE);
|
1663
|
+
MAP_LXW_WH_CONST1(OBJECT_MOVE_AND_SIZE_AFTER);
|
1774
1664
|
#undef MAP_LXW_WH_CONST1
|
1775
1665
|
#undef MAP_LXW_WH_CONST
|
1776
1666
|
}
|