Skip to content

Instantly share code, notes, and snippets.

@mokapyo
Created June 24, 2017 15:31
Show Gist options
  • Save mokapyo/ce8d2b8874c9e8ee5f00803886e47563 to your computer and use it in GitHub Desktop.
Save mokapyo/ce8d2b8874c9e8ee5f00803886e47563 to your computer and use it in GitHub Desktop.
#include <Windows.h>
#include <Ole2.h>
#include <stdio.h>
#include "CExcelEdit.h"
int main(int argc, char* argv[]) {
// ファイルのオープン
CString FilePath = _T("C:\\test\\a.xlsx");
CString SheetName = _T("Sheet2");
CExcelEdit ExcelEdit(FilePath,SheetName);
// 値の読み込み(数値)
{
CString Cell = _T("A1");
DOUBLE ReadValue = ExcelEdit.ReadNum(Cell);
CString msg;
msg.Format(_T("%f"), ReadValue);
MessageBox(NULL, msg, _T("ReadValue"), MB_OK);
}
// 値の読み込み(文字)
{
CString Cell = _T("A2");
CString ReadValue = ExcelEdit.ReadStr(Cell);
MessageBox(NULL, ReadValue, _T("ReadValue"), MB_OK);
}
// 値の書き込み(数値)
{
CString Cell = _T("B1");
DOUBLE WriteValue = 1.5;
bool bResult = ExcelEdit.WriteNum(Cell, WriteValue);
}
// 値の書き込み(文字)
{
CString Cell = _T("B2");
CString WriteValue = _T("Testだよ!");
bool bResult = ExcelEdit.WriteStr(Cell, WriteValue);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment