static void example1(const char* path) { BasicExcel xls; // create sheet 1 and get the associated BasicExcelWorksheet pointer xls.New(1); BasicExcelWorksheet* sheet = xls.GetWorksheet(0); XLSFormatManager fmt_mgr(xls); // Create a table containing an header row in bold and four rows below. ExcelFont font_bold; font_bold._weight = FW_BOLD; // 700 CellFormat fmt_bold(fmt_mgr); fmt_bold.set_font(font_bold); int col, row = 0; for(col=0; col<10; ++col) { BasicExcelCell* cell = sheet->Cell(row, col); cell->Set("TITLE"); cell->SetFormat(fmt_bold); } while(++row < 4) { for(int col=0; col<10; ++col) sheet->Cell(row, col)->Set("text"); } ++row; ExcelFont font_red_bold; font_red_bold._weight = FW_BOLD; font_red_bold._color_index = EGA_RED; CellFormat fmt_red_bold(fmt_mgr, font_red_bold); fmt_red_bold.set_color1(COLOR1_PAT_SOLID); // solid background fmt_red_bold.set_color2(MAKE_COLOR2(EGA_BLUE,0)); // blue background CellFormat fmt_green(fmt_mgr, ExcelFont().set_color_index(EGA_GREEN)); for(col=0; col<10; ++col) { BasicExcelCell* cell = sheet->Cell(row, col); cell->Set("xxx"); cell->SetFormat(fmt_red_bold); cell = sheet->Cell(row, ++col); cell->Set("yyy"); cell->SetFormat(fmt_green); } xls.SaveAs(path); }
static void example4(const char* path) { BasicExcel xls; xls.New(1); BasicExcelWorksheet* sheet = xls.GetWorksheet(0); XLSFormatManager fmt_mgr(xls); char buffer[100]; int i = 0; for(int row=0; row<8; ++row) { int color = i++; int height = 100 * i; sprintf(buffer, "Times New Roman %d", height/20); ExcelFont font; font.set_color_index(color); font.set_height(height); font.set_font_name(L"Times New Roman"); CellFormat fmt(fmt_mgr, font); fmt.set_background(MAKE_COLOR2(EGA_MAGENTA,0)); // solid magenta background BasicExcelCell* cell = sheet->Cell(row, 0); cell->Set(buffer); cell->SetFormat(fmt); } xls.SaveAs(path); }
static void write_big_sheet(const char* path, const int row_max, const int col_max) { BasicExcel xls; char buffer[16]; // create sheet 1 and get the associated BasicExcelWorksheet pointer xls.New(1); BasicExcelWorksheet* sheet = xls.GetWorksheet(0); XLSFormatManager fmt_mgr(xls); // Create a table containing header row and column in bold. ExcelFont font_bold; font_bold._weight = FW_BOLD; // 700 CellFormat fmt_bold(fmt_mgr); fmt_bold.set_font(font_bold); int col, row; BasicExcelCell* cell = sheet->Cell(0, 0); cell->Set("Row / Column"); cell->SetFormat(fmt_bold); for(col=1; col<=col_max; ++col) { cell = sheet->Cell(0, col); sprintf(buffer, "Column %d", col); cell->Set(buffer); cell->SetFormat(fmt_bold); } for(row=1; row<=row_max; ++row) { cell = sheet->Cell(row, 0); sprintf(buffer, "Row %d", row); cell->Set(buffer); cell->SetFormat(fmt_bold); } for(row=1; row<=row_max; ++row) { for(int col=1; col<=col_max; ++col) { sprintf(buffer, "%d / %d", row, col); sheet->Cell(row, col)->Set(buffer); } } xls.SaveAs(path); }
int main() { BasicExcel xls; // create sheet 1 and get the associated BasicExcelWorksheet pointer xls.New(1); xls.workbook_.definedName_.setName("shit"); BasicExcelWorksheet* sheet = xls.GetWorksheet(0); XLSFormatManager fmt_mgr(xls); ExcelFont font_header; font_header.set_weight(FW_BOLD); font_header.set_underline_type(EXCEL_UNDERLINE_SINGLE); font_header.set_font_name(L"Times New Roman"); font_header.set_color_index(EGA_BLUE); font_header._options = EXCEL_FONT_STRUCK_OUT; CellFormat fmt_header(fmt_mgr, font_header); fmt_header.set_rotation(30); // rotate the header cell text 30?to the left int row = 0; for(int col=0; col<10; ++col) { BasicExcelCell* cell = sheet->Cell(row, col); cell->Set("TITLE"); cell->SetFormat(fmt_header); } char buffer[100]; while(++row < 10) { for(int col=0; col<10; ++col) { sprintf(buffer, "text %d/%d", row, col); sheet->Cell(row, col)->Set(buffer); } } xls.SaveAs("fasdf.xls"); xls.Close(); }
static void example3(const char* path) { BasicExcel xls; // create sheet 1 and get the associated BasicExcelWorksheet pointer xls.New(1); BasicExcelWorksheet* sheet = xls.GetWorksheet(0); XLSFormatManager fmt_mgr(xls); CellFormat fmt(fmt_mgr); BasicExcelCell* cell; // row 1 fmt.set_format_string(XLS_FORMAT_INTEGER); cell = sheet->Cell(0, 0); cell->Set(1.); cell->SetFormat(fmt); fmt.set_format_string(XLS_FORMAT_DECIMAL); cell = sheet->Cell(0, 1); cell->Set(2.); cell->SetFormat(fmt); fmt.set_format_string(XLS_FORMAT_DATE); fmt.set_font(ExcelFont().set_weight(FW_BOLD)); cell = sheet->Cell(0, 2); cell->Set("03.03.2000"); cell->SetFormat(fmt); // row 2 fmt.set_font(ExcelFont().set_weight(FW_NORMAL)); fmt.set_format_string(XLS_FORMAT_GENERAL); cell = sheet->Cell(1, 0); cell->Set("normal"); cell->SetFormat(fmt); fmt.set_format_string(XLS_FORMAT_TEXT); cell = sheet->Cell(1, 1); cell->Set("Text"); cell->SetFormat(fmt); fmt.set_format_string(XLS_FORMAT_GENERAL); fmt.set_font(ExcelFont().set_weight(FW_BOLD)); cell = sheet->Cell(1, 2); cell->Set("bold"); cell->SetFormat(fmt); xls.SaveAs(path); }
static void example_read_write(const char* from, const char* to) { cout << "read " << from << endl; BasicExcel xls(from); XLSFormatManager fmt_mgr(xls); BasicExcelWorksheet* sheet = xls.GetWorksheet(0); CellFormat fmt_general(fmt_mgr); fmt_general.set_format_string("0.000"); for(int y=0; y<2; ++y) { for(int x=0; x<2; ++x) { cout << y << "/" << x; BasicExcelCell* cell = sheet->Cell(y, x); CellFormat fmt(fmt_mgr, cell); // cout << " - xf_idx=" << cell->GetXFormatIdx(); const Workbook::Font& font = fmt_mgr.get_font(fmt); string font_name = stringFromSmallString(font.name_); cout << " font name: " << font_name; const wstring& fmt_string = fmt.get_format_string(); cout << " format: " << narrow_string(fmt_string); cell->SetFormat(fmt_general); cout << endl; } } cout << "write: " << from << endl; xls.SaveAs(to); }
// Todo: Verify bool ChecklistController::init(char *checkFile) { if (!init(true)) return false; if (*checkFile == '\0') { if (!file.Load(DefaultChecklistFile)) { return false; } } else if (!file.Load(checkFile)) { if (!file.Load(DefaultChecklistFile)) { return false; } } BasicExcelWorksheet* sheet; vector<BasicExcelCell> cells; ChecklistGroup temp; sheet = file.GetWorksheet("GROUPS"); if (sheet) { for (int i = 1; i < sheet->GetTotalRows(); i++) { // Ignore empty texts if (sheet->Cell(i,0)->GetString() != 0) { for (int ii = 0; ii < 10 /* Number of columns in accepted sheet */; ii++) cells.push_back(*sheet->Cell(i,ii)); temp.init(cells); temp.group = groups.size(); groups.push_back(temp); temp = ChecklistGroup(); cells = vector<BasicExcelCell>(); } } } return true; }
int main(int argc, char* argv[]) { BasicExcel e; // Load a workbook with one sheet, display its contents and save into another file. e.Load("example1.xls"); BasicExcelWorksheet* sheet1 = e.GetWorksheet("Sheet1"); if (sheet1) { size_t maxRows = sheet1->GetTotalRows(); size_t maxCols = sheet1->GetTotalCols(); cout << "Dimension of " << sheet1->GetAnsiSheetName() << " (" << maxRows << ", " << maxCols << ")" << endl; printf(" "); for (size_t c=0; c<maxCols; ++c) printf("%10d", c+1); cout << endl; for (size_t r=0; r<maxRows; ++r) { printf("%10d", r+1); for (size_t c=0; c<maxCols; ++c) { BasicExcelCell* cell = sheet1->Cell(r,c); switch (cell->Type()) { case BasicExcelCell::UNDEFINED: printf(" "); break; case BasicExcelCell::INT: printf("%10d", cell->GetInteger()); break; case BasicExcelCell::DOUBLE: printf("%10.6lf", cell->GetDouble()); break; case BasicExcelCell::STRING: printf("%10s", cell->GetString()); break; case BasicExcelCell::WSTRING: wprintf(L"%10s", cell->GetWString()); break; } } cout << endl; } } cout << endl; e.SaveAs("example2.xls"); // Create a new workbook with 2 worksheets and write some contents. e.New(2); e.RenameWorksheet("Sheet1", "Test1"); BasicExcelWorksheet* sheet = e.GetWorksheet("Test1"); BasicExcelCell* cell; if (sheet) { for (size_t c=0; c<4; ++c) { cell = sheet->Cell(0,c); cell->Set((int)c); } cell = sheet->Cell(1,3); cell->SetDouble(3.141592654); sheet->Cell(1,4)->SetString("Test str1"); sheet->Cell(2,0)->SetString("Test str2"); sheet->Cell(2,5)->SetString("Test str1"); sheet->Cell(4,0)->SetDouble(1.1); sheet->Cell(4,1)->SetDouble(2.2); sheet->Cell(4,2)->SetDouble(3.3); sheet->Cell(4,3)->SetDouble(4.4); sheet->Cell(4,4)->SetDouble(5.5); sheet->Cell(4,4)->EraseContents(); } sheet = e.AddWorksheet("Test2", 1); sheet = e.GetWorksheet(1); if (sheet) { sheet->Cell(1,1)->SetDouble(1.1); sheet->Cell(2,2)->SetDouble(2.2); sheet->Cell(3,3)->SetDouble(3.3); sheet->Cell(4,4)->SetDouble(4.4); sheet->Cell(70,2)->SetDouble(5.5); } e.SaveAs("example3.xls"); // Load the newly created sheet and display its contents e.Load("example3.xls"); size_t maxSheets = e.GetTotalWorkSheets(); cout << "Total number of worksheets: " << e.GetTotalWorkSheets() << endl; for (size_t i=0; i<maxSheets; ++i) { BasicExcelWorksheet* sheet = e.GetWorksheet(i); if (sheet) { size_t maxRows = sheet->GetTotalRows(); size_t maxCols = sheet->GetTotalCols(); cout << "Dimension of " << sheet->GetAnsiSheetName() << " (" << maxRows << ", " << maxCols << ")" << endl; if (maxRows>0) { printf(" "); for (size_t c=0; c<maxCols; ++c) printf("%10d", c+1); cout << endl; } for (size_t r=0; r<maxRows; ++r) { printf("%10d", r+1); for (size_t c=0; c<maxCols; ++c) { cout << setw(10) << *(sheet->Cell(r,c)); // Another way of printing a cell content. } cout << endl; } if (i==0) { ofstream f("example4.csv"); sheet->Print(f, ',', '\"'); // Save the first sheet as a CSV file. f.close(); } } cout << endl; } return 0; }
void WriteSymbolsTableToXLS(const SymbolsTable& symbolsTable, const char* filepath) { BasicExcel xlsFile; BasicExcelWorksheet* worksheet = xlsFile.AddWorksheet("Symbols"); worksheet->Cell(0, 0)->Set(L"Classes ->"); int row = 1; for (map<string, SymbolClass>::const_iterator curClass = symbolsTable.begin(), lastClass = symbolsTable.end(); curClass != lastClass; ++curClass) { worksheet->Cell(row, 0)->Set(curClass->second.name.c_str()); if (curClass->second.functions.empty()) { row += 2; continue; } worksheet->Cell(row + 2, 0)->Set(L"Methods ->"); worksheet->Cell(row + 2, 1)->Set(L"Modifier"); worksheet->Cell(row + 2, 2)->Set(L"Return type"); worksheet->Cell(row + 2, 3)->Set(L"Name"); worksheet->Cell(row + 2, 4)->Set(L"Parameters"); row += 3; for (auto curFunction : curClass->second.functions) { worksheet->Cell(row, 1)->Set(curFunction.second.modifier.c_str()); worksheet->Cell(row, 2)->Set(curFunction.second.returnType.c_str()); worksheet->Cell(row, 3)->Set(curFunction.second.name.c_str()); int parameterIndex = 0; for (auto curParameter = curFunction.second.parameters.begin(), lastParameter = curFunction.second.parameters.end(); curParameter != lastParameter; ++curParameter) { worksheet->Cell(row, 4 + parameterIndex)->Set((curParameter->second.name + ": " + curParameter->second.type).c_str()); ++parameterIndex; } worksheet->Cell(row + 1, 0)->Set(L"Blocks ->"); ++row; for (auto curBlock = curFunction.second.blocks.begin(), lastBlock = curFunction.second.blocks.end(); curBlock != lastBlock; ++curBlock) { WriteBlocksToXLS(worksheet, row, 1, *curBlock); ++row; } ++row; } ++row; } worksheet->SetColWidth(0, 15000); worksheet->SetColWidth(1, 15000); xlsFile.SaveAs(filepath); }
int main (int argc, char *argv[]) { srand (int(time(NULL))); if (argc != 2) { if (argc < 2) cout << "Error. Input file was not specified.\n"; if (argc > 2) cout << "Error. Too many arguments.\n"; return 1; } QSqlDatabase database = QSqlDatabase::addDatabase(DBTYPE); database.setHostName(HOST); database.setPort(GATE); database.setDatabaseName(DATABASE); database.setUserName(USER); database.setPassword(PASS); database.open(); int tryCount = 0; while (!database.isOpen() && tryCount++ < DBLIMIT) { cout << "Database connection error. Attempting to reconnect in 5 seconds.\n"; sleep(5); cout << "Reconnecting attempt... " << tryCount << "/" << DBLIMIT << "\n"; database.open(); } if (!database.isOpen()) { cout << "Database connection error."; return 2; } FILE *phpFile, *myFile; char tmpName[500]="0"; strcpy(tmpName, argv[1]); char* here = strrchr(tmpName, '/'); if (here != NULL) { here+=1; strcpy(here, "tmp_file.xls\0"); } else strcpy(tmpName, "tmp_file.xls\0"); phpFile = fopen(argv[1], "rb"); myFile = fopen(tmpName, "wb"); if (phpFile == NULL) { cout << "File open error: " << argv[1] << endl; return 3; } if (myFile == NULL) { cout << "Temp file create error" << endl; return 4; } char buff[1024] = "\0"; int size = 0; while (!feof(phpFile) && !ferror(phpFile)) { size = fread(buff, 1, 1024, phpFile); fwrite(buff, 1, size, myFile); } if (ferror(phpFile)) { cout << "File read error." << endl; return 5; } fclose(phpFile); fclose(myFile); BasicExcel xls; if (!xls.Load(tmpName)) { cout << "Specified file is not excel file. " << endl; return 6; } BasicExcelWorksheet* sheet = xls.GetWorksheet(0); int rows = sheet->GetTotalRows(), test = 0, c0=0, c1=0, c2=0, c3=0; // XLS TYPES: 0-UNDEFINED, 1-INTEGER, 2-DOUBLE, 3-STRING, 4-WSTRING, 5-FORMULA while (test < rows) { c0=sheet->Cell(test, 0)->Type(); c1=sheet->Cell(test, 1)->Type(); c2=sheet->Cell(test, 2)->Type(); c3=sheet->Cell(test, 3)->Type(); if ((c0 != 3 && c0 != 4) || (c1 != 3 && c1 != 4) || (c2 != 1 && c2 != 2) || (c3 != 3)) { cout << "Error. Wrong table format.\nc0=" << c0 << "; c1=" << c1 << "; c2=" << c2 << "; c3=" << c3 << ";\n"; return 7; } test++; } QSqlQuery insertQuery(database), testQuery(database); QString templ = "insert into users (name, surname, pass, mail, indeks) values (\"%1\", \"%2\", \"%3\", \"%4\", %5);"; QString testTemplIndex = "SELECT id FROM users WHERE %1 = %2"; QString testTemplMail = "SELECT id FROM users WHERE %1 = \"%2\""; QString statement, name, surname, mail, index, pass; QRegExp mailPattern("^[a-zA-Z0-9_\\.\\-]+@[a-zA-Z0-9\\-]+\\.[a-zA-Z0-9\\-\\.]+$"); char passwd[9]; int i=0, insert_test = 0, pasch=0; while (i < rows) { getCellVal(name, sheet, i, 0); getCellVal(surname, sheet, i, 1); getCellVal(mail, sheet, i, 3); index.clear(); index = QString::number(sheet->Cell(i,2)->GetInteger()); strcpy(passwd, "AAAAAAAA"); for (pasch=0; pasch < 8; pasch++) { passwd[pasch]+= (rand()%26); if (rand()%2) passwd[pasch]+= 32; } passwd[pasch]='\0'; pass = passwd; cout << index.toStdString() << endl << name.toUtf8().data() << endl << surname.toUtf8().data() << endl << mail.toStdString() << endl; if (name.indexOf(QRegExp("[^A-Za-z]")) != -1) { cout << "1" << endl << QString::fromUtf8("Błędne imie").toUtf8().data() << endl << "0" << endl; i++; continue; } if (surname.indexOf(QRegExp("[^A-Za-z]")) != -1) { cout << "1" << endl << QString::fromUtf8("Błędne nazwisko").toUtf8().data() << endl << "0" << endl; i++; continue; } if (index.indexOf(QRegExp("[^0-9]")) != -1) { cout << "1" << endl << QString::fromUtf8("Błędny index").toUtf8().data() << endl << "0" << endl; i++; continue; } if (!mailPattern.exactMatch(mail)) { cout << "1" << endl << QString::fromUtf8("Błędny adres email").toUtf8().data() << endl << "0" << endl; i++; continue; } testQuery.exec(testTemplIndex.arg(QString("indeks"), index)); if (testQuery.size() != 0) { testQuery.next(); cout << "1" << endl << QString::fromUtf8("Użytkownik o podanym indeksie jest już w bazie, ale został dodany do grupy").toUtf8().data() << endl << QString::number(testQuery.value(0).toInt()).toAscii().data() << endl; i++; continue; } testQuery.exec(testTemplMail.arg(QString("mail"), mail)); if (testQuery.size() != 0) { cout << "1" << endl << QString::fromUtf8("Użytkownik o podanym emailu jest już w bazie").toUtf8().data() << endl << "0" << endl; i++; continue; } statement = templ.arg(name, surname, (QCryptographicHash::hash(pass.toAscii(), QCryptographicHash::Sha1)).toHex(), mail, index); if (!insertQuery.exec(statement)) cout << "1" << endl << insertQuery.lastError().text().toUtf8().data() << endl << "0" << endl; else { cout << "0" << endl << passwd << endl << QString::number(insertQuery.lastInsertId().toInt()).toAscii().data() << endl; insert_test++; } i++; } if ( remove(tmpName) != 0) { cout << "Error deleting temp file." << endl; return 8; } if (remove(argv[1]) != 0) { cout << "Error deleting file " << argv[1] << endl; return 9; } if (insert_test <= 0) return 200; if (insert_test < rows) return 100; return 0; }
std::string VLDDexporter::CommandProcessor::RunCommands(InputProcessor& data){ // let's run filters on the input data // _FilterInputData(data); // run the routine with the loaded parameters // // output spreadsheet // BasicExcel xls; // workbook sheets: // hot files, hot functions, summary, leaked blocks xls.New(4); // create hot files sheet // BasicExcelWorksheet* hotfilessheet = xls.GetWorksheet(0); hotfilessheet->Rename("Hot files"); // hot functions sheet // BasicExcelWorksheet* hotfunctions = xls.GetWorksheet(1); hotfunctions->Rename("Hot functions"); // summary sheet // //BasicExcelWorksheet* summarysheet = xls.GetWorksheet(2); //summarysheet->Rename("Summary"); // leaked blocks // //BasicExcelWorksheet* leakedblocks = xls.GetWorksheet(3); //leakedblocks->Rename("Leaked blocks"); XLSFormatManager fmt_mgr(xls); // create required fonts // ExcelFont fontheader; fontheader._weight = FW_BOLD; //fontheader._color_index = ExcelFont fontdata; fontheader._weight = FW_NORMAL; CellFormat fmtheader(fmt_mgr); fmtheader.set_font(fontheader); CellFormat fmtdata(fmt_mgr); fmtdata.set_font(fontdata); int Row = 0; int Col = 0; // hot files // for(Col = 0; Col < 4; Col++){ // get current cell // BasicExcelCell* cell = hotfilessheet->Cell(Row, Col); switch(Col){ case 0: { cell->Set("File"); } break; case 1: { cell->Set("Blame count"); } break; case 2: { cell->Set("Lines"); } break; case 3: { cell->Set("Blame gathering function"); } break; } cell->SetFormat(fmtheader); } // set proper widths // hotfilessheet->SetColWidth(0, 24000); hotfilessheet->SetColWidth(1, 5000); hotfilessheet->SetColWidth(2, 6000); hotfilessheet->SetColWidth(3, 10000); // output data // for(size_t i = 0; i < data.LeakingFiles.size(); i++){ // increase row // Row++; CallstackFileEntry* file = data.LeakingFiles[i].get(); for(Col = 0; Col < 4; Col++){ // get current cell // BasicExcelCell* cell = hotfilessheet->Cell(Row, Col); switch(Col){ case 0: { cell->Set(file->PathOrName.c_str()); } break; case 1: { cell->SetInteger(file->BlameCount); } break; case 2: { string lines; for(size_t a = 0; a < file->LeakLines.size(); a++){ if(a != 0) lines += ", "; stringstream converter; converter << file->LeakLines[a]; string tmpstr = ""; converter >> tmpstr; lines += tmpstr; } cell->Set(lines.c_str()); } break; case 3: { cell->Set(file->FunctionsInfile[0]->Name.c_str()); } break; } cell->SetFormat(fmtdata); } } Row = 0; Col = 0; // output hot functions // for(Col = 0; Col < 4; Col++){ // get current cell // BasicExcelCell* cell = hotfunctions->Cell(Row, Col); switch(Col){ case 0: { cell->Set("Function"); } break; case 1: { cell->Set("Blame count"); } break; case 2: { cell->Set("File"); } break; case 3: { cell->Set("Line"); } break; } cell->SetFormat(fmtheader); } // set proper widths // hotfunctions->SetColWidth(0, 32000); hotfunctions->SetColWidth(1, 5000); hotfunctions->SetColWidth(2, 24000); // output data // for(size_t i = 0; i < data.LeakingFunctions.size(); i++){ // increase row // Row++; CallstackFunction* func = data.LeakingFunctions[i].get(); for(Col = 0; Col < 4; Col++){ // get current cell // BasicExcelCell* cell = hotfunctions->Cell(Row, Col); switch(Col){ case 0: { cell->Set(func->Name.c_str()); } break; case 1: { cell->SetInteger(func->BlameCount); } break; case 2: { cell->Set(func->ContainedInFile->PathOrName.c_str()); } break; case 3: { cell->SetInteger(func->Line); } break; } cell->SetFormat(fmtdata); } } string finaloutput = OutputFilePath+OutputFile; // delete old first // wstringstream sstream; sstream << finaloutput.c_str(); wstring path; sstream >> path; DeleteFile((L"\\\\?\\"+path).c_str()); // save file // xls.SaveAs(finaloutput.c_str()); // return the created output // return OutputFilePath+OutputFile; }
void network_generator::write_output(){ for(int k=0;k<channel_layer;k++){ BasicExcel xls; // create sheet 1 and get the associated BasicExcelWorksheet pointer xls.New(1); BasicExcelWorksheet* sheet = xls.GetWorksheet(0); XLSFormatManager fmt_mgr(xls); // Create a table containing an header row in bold and four rows below. ExcelFont font_bold; font_bold._weight = FW_BOLD; // 700 CellFormat fmt_bold(fmt_mgr); fmt_bold.set_font(font_bold); ExcelFont font_red_bold; font_red_bold._weight = FW_BOLD; font_red_bold._color_index = EGA_BLACK; CellFormat color_1(fmt_mgr, font_red_bold); color_1.set_color1(COLOR1_PAT_SOLID); color_1.set_color2(MAKE_COLOR2(29,0)); CellFormat color_2(fmt_mgr, font_red_bold); color_2.set_color1(COLOR1_PAT_SOLID); color_2.set_color2(MAKE_COLOR2(16,0)); for (int i=0;i<101;i++){ for(int j=0;j<101;j++){ BasicExcelCell* cell = sheet->Cell(i, j); if(i%2 == 0 && j%2 == 0){ cell->SetFormat(color_2); sheet->Cell(i, j)->Set(-1); } else{ cell->SetFormat(color_1); sheet->Cell(i, j)->Set(liquid_network[k][i][j]); } } } for (int i=0;i<101;i++){ sheet->SetColWidth(i,950); } char layernum = k+48; string test_case_num = "0"; test_case_num += char(chip.case_num+48); string output_name=""; output_name += "cada030_problemA_testcase"; output_name += test_case_num; if(channel_layer > 1){ output_name += "_channellayer"; output_name += layernum; } output_name += ".xls"; xls.SaveAs(&output_name[0]); } }