Excel, A1 A1 the bar no value
I mainly want to put the interface and the database data export to excel, use cycle is tested under in this statement, but there is no value, before get_range sheet can be used to lose as a single, single is behind the seemingly can only write A1, A2, if can't use the I said to cycle
Check it on the website put_Item this way, but according to the first sentence that no hello output, consult!
By the way I am using ODBC
CodePudding user response:
Why don't you use SetItem?M_ExlRge. SetItem (_variant_t (lItenIndex), _variant_t ((long), 1), _variant_t ((long) lRecordIndex));
CodePudding user response:
Top, LS saidCodePudding user response:
This does not seem to set_Item only put_ItemCodePudding user response:
We have CRange ODBC how?
# import "MSO9. DLL" rename (" RGB ", "RBGMSO") rename (" SearchPath ", "SearchPathMSO") \
Rename (" DocumentProperties DocumentPropertiesMSO ", "") no_auto_exclude
# import "VBE6EXT. OLB" no_namespace no_auto_exclude
# import "EXCEL9. OLB" rename (" RGB ", "RBGXL") rename (" DialogBox ", "DialogBoxXL") \
Rename (" used by CopyFile CopyFileXL ", "") rename (" ReplaceText", "ReplaceTextXL") rename (" IPicture ", "IPictureXL") \
Rename (" IFont IFontXL ", "") rename (" DocumentProperties", "DocumentPropertiesXL") no_dual_interfaces no_auto_exclude
#include
#include
Void dump_com_error (_com_error & amp; E)
{
_tprintf (_T (" Oops - hit an error! \ n "));
_tprintf (_T (" \ \ a tCode=% 08 lx \ n "), e.E rror ());
_tprintf (_T (" \ \ a tCode fancy=% s \ n "), e.E rrorMessage ());
_bstr_t bstrSource (e.S ource ());
_bstr_t bstrDescription (e.D escription ());
_tprintf (_T (" \ \ a tSource=% s \ n "), (LPCTSTR) bstrSource);
_tprintf (_T (" \ \ a tDescription=% s \ n "), (LPCTSTR) bstrDescription);
}
//If this is placed in the scope of the smart Pointers, they must be
//explicitly Release (d) before CoUninitialize () is called. If any reference
//count is non - zero, a protection fault will occur.
Struct StartOle {
StartOle () {CoInitialize (NULL); }
~ StartOle () {CoUninitialize (); }
} _inst_StartOle;
Void main ()
{
Using the namespace Excel;
_ApplicationPtr pXL;
Try
{
PXL. CreateInstance (L "Excel. Application");
The pXL - & gt; The Visible=VARIANT_TRUE;
WorkbooksPtr pBooks=pXL - & gt; Workbooks.
_WorkbookPtr pBook=pBooks - & gt; Add ((long) xlWorksheet);
_WorksheetPtr pSheet=pXL - & gt; ActiveSheet.
Try {
//one will fail
PSheet - & gt; Name="Market Share?" ;
} the catch (_com_error & amp; E) {
Dump_com_error (e);
}
PSheet - & gt; Name="Market Share!" ;
PSheet - & gt; Range [" A2 "] - & gt; A "Value=" https://bbs.csdn.net/topics/Company;
PSheet - & gt; Range [" B2 "] - & gt; B Value="https://bbs.csdn.net/topics/Company";
PSheet - & gt; Range [" C2 "] - & gt; C Value="https://bbs.csdn.net/topics/Company";
PSheet - & gt; Range [" D2 "] - & gt; D Value="https://bbs.csdn.net/topics/Company";
PSheet - & gt; Range [" A3 "] - & gt; Value=https://bbs.csdn.net/topics/75.0;
PSheet - & gt; Range [" B3 "] - & gt; Value=https://bbs.csdn.net/topics/14.0;
PSheet - & gt; Range [" C3 "] - & gt; Value=https://bbs.csdn.net/topics/7.0;
PSheet - & gt; Range [" D3 "] - & gt; Value=https://bbs.csdn.net/topics/4.0;
Sleep(1000);
RangePtr pRange=pSheet - & gt; Range [A2: "D3"];
_ChartPtr pChart=pBook - & gt; Charts - & gt; The Add ();
PChart - & gt; PRange ChartWizard (Range (*), (long) xl3DPie, 7 l, (long) xlRows,
1 l, 0 l, 2 l, "Market Share");
Sleep (6000);
PBook - & gt; Saved=VARIANT_TRUE;
The pXL - & gt; The Quit ();
} the catch (_com_error & amp; E) {
Dump_com_error (e);
}
}
CodePudding user response: