Bonjour

J'utilise Visual C++ 2008 express,

Je veux lire et modifier un fichier Excel, si le fichier nommé en français l'opération est terminé avec succèes mais si le fichier nommé en arabe l'opération s'arrête et affiche un messsage:

Nom : qscqsdcqsd.PNG
Affichages : 210
Taille : 31,3 Ko

Violà le code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "ExcelFormat.h"
 
using namespace ExcelFormat;
 
#ifdef _WIN32
 
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shellapi.h>
#include <crtdbg.h>
 
#else // _WIN32
 
#define FW_NORMAL   400
#define FW_BOLD     700
 
#endif // _WIN32
 
 
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.00");
 
    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);
}
 
int main(int argc, char** argv)
{
#ifdef _MSC_VER
     // detect memory leaks
//  _CrtSetDbgFlag(_CrtSetDbgFlag(0)|_CRTDBG_LEAK_CHECK_DF);
#endif
 
    example_read_write("example.xls", "example.xls");
    example_read_write("ملف.xls", "ملف.xls");
 
    return 0;
}
Merci