1 2 3 #include <Rcpp.h> 4 #include <iostream> 5 #include <fstream> 6 #include <sstream> 7 8 using namespace Rcpp; 9 using namespace std; 10 11 12 13 // load workbook 14 int cell_ref_to_col(string ); 15 CharacterVector int_2_cell_ref(IntegerVector); 16 17 // write file 18 SEXP write_worksheet_xml(string, string, List, Reference, IntegerVector, CharacterVector, string ); 19 20 21 // write_data.cpp 22 CharacterVector map_cell_types_to_char(IntegerVector); 23 IntegerVector map_cell_types_to_integer(CharacterVector); 24 25 26 27 std::vector<std::string> get_letters(); 28 29 30 IntegerVector convert_from_excel_ref( CharacterVector x ); 31 32 SEXP calc_column_widths(Reference sheet_data, std::vector<std::string> sharedStrings, IntegerVector autoColumns, NumericVector widths, float baseFontCharWidth, float minW, float maxW); 33 34 SEXP getOpenClosedNode(std::string xml, std::string open_tag, std::string close_tag); 35 36 std::string cppReadFile(std::string xmlFile); 37 std::string read_file_newline(std::string xmlFile); 38 39 40 SEXP getNodes(std::string xml, std::string tagIn); 41 std::vector<std::string> getChildlessNode_ss(std::string xml, std::string tag); 42 CharacterVector get_extLst_Major(std::string xml); 43 CharacterVector getChildlessNode(std::string xml, std::string tag); 44 SEXP getAttr(CharacterVector x, std::string tag); 45 46 CharacterVector get_shared_strings(std::string xmlFile, bool isFile); 47 48 49 List buildCellList( CharacterVector r, CharacterVector t, CharacterVector v); 50 SEXP openxlsx_convert_to_excel_ref(IntegerVector cols, std::vector<std::string> LETTERS); 51 52 SEXP buildMatrixNumeric(CharacterVector v, IntegerVector rowInd, IntegerVector colInd, 53 CharacterVector colNames, int nRows, int nCols); 54 55 SEXP buildMatrixMixed(CharacterVector v, 56 IntegerVector rowInd, 57 IntegerVector colInd, 58 CharacterVector colNames, 59 int nRows, 60 int nCols, 61 IntegerVector charCols, 62 IntegerVector dateCols); 63 64 List getCellInfo(std::string xmlFile, 65 CharacterVector sharedStrings, 66 bool skipEmptyRows, 67 int startRow, 68 IntegerVector rows, 69 bool getDates); 70 71 72 SEXP convert_to_excel_ref_expand(const std::vector<int>& cols, const std::vector<std::string>& LETTERS, const std::vector<std::string>& rows); 73 74 IntegerVector matrixRowInds(IntegerVector indices); 75 CharacterVector build_table_xml(std::string table, std::string ref, std::vector<std::string> colNames, bool showColNames, std::string tableStyle, bool withFilter); 76 int calc_number_rows(CharacterVector x, bool skipEmptyRows); 77 CharacterVector buildCellTypes(CharacterVector classes, int nRows); 78 LogicalVector isInternalHyperlink(CharacterVector x); 79 80 81 // helper functions 82 string itos(int i); 83 SEXP write_file(std::string parent, std::string xmlText, std::string parentEnd, std::string R_fileName); 84 CharacterVector markUTF8(CharacterVector x, bool clone = false); 85