문제

셀의 숫자 형식을 설정하려고 하는데 xlcFormatNumber에 대한 호출이 셀 번호 형식을 "일반"으로 유지하는 데 실패합니다.xlSet을 사용하여 셀 값을 성공적으로 설정할 수 있습니다.

XLOPER xRet;
XLOPER xRef;

//try to set the format of cell A1
xRef.xltype = xltypeSRef;
xRef.val.sref.count = 1;
xRef.val.sref.ref.rwFirst = 0;
xRef.val.sref.ref.rwLast = 0;
xRef.val.sref.ref.colFirst = 0;
xRef.val.sref.ref.colLast = 0;

XLOPER xFormat; 
xFormat.xltype = xltypeStr;
xFormat.val.str = "\4#.00"; //I've tried various formats

Excel4( xlcFormatNumber, &xRet, 2, (LPXLOPER)&xRef, (LPXLOPER)&xFormat);

이 명령의 사용법에 관한 문서를 찾지 못했습니다.여기에 도움을 주시면 대단히 감사하겠습니다.

도움이 되었습니까?

해결책

답변을 주신 Simon Murphy에게 감사드립니다.스프레드시트의 스머프

//It is necessary to select the cell to apply the formatting to
Excel4 (xlcSelect, 0, 1, &xRef);

//Then we apply the formatting
Excel4( xlcFormatNumber, 0, 1, &xFormat);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top