|
Hi ,
By Default it should have added default no of sheets in your excel according to the setting in the excel in mine its three .
You can also customize it using the following code :-
int lNoOfSheetsInNewWorkBook =2;
books = app.GetWorkbooks();
app.SetSheetsInNewWorkbook(lNoOfSheetsInNewWorkBook);
book = books.Add (covOptional);
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
Hi,
Thanks. I know the way u suggest. But is their any other way to do this because I have delete third sheet in this case or I may require to add the chart instead of sheet(i.e 1 sheet,1 chart in Excel). That's why I am looking for adding sheet/chart separetly.
|
|
|
|
|
Hi ,
You mean like this :-
_Worksheet objWorkSheet;
LPDISPATCH lpDipatch;
VARIANT sheetVar = {(short)(2 + nNewSheet)};
int count = sheets.GetCount();
objWorkSheet = sheets.GetItem(COleVariant( (short)(2 + nNewSheet)));
// Create References
sheetVar.vt = VT_DISPATCH;
sheetVar.pdispVal = objWorkSheet.m_lpDispatch;
objWorkSheet.m_lpDispatch->AddRef();
// Add new sheet at the end
lpDipatch = sheets.Add( covOptional, sheetVar,
covOptional, covOptional);
VariantClear(&sheetVar);
objWorkSheet.AttachDispatch( lpDipatch );
objWorkSheet.ReleaseDispatch();
objWorkSheet.DetachDispatch();
Regards,
FarPointer
Blog:http://farpointer.blogspot.com/
|
|
|
|
|
Hi,
I am doing like this.
CWorkbooks m_books=m_app.get_Workbooks();
m_books=m_books.Add(COleVariant(xlWorkSheet));
Like this way I am able to create 1 sheet. If I add 2nd sheet using this way then 2nd sheet open in another Excel application.
|
|
|
|
|
Hello c++ friends!
I am currently working on a handy program that scans temperature/fan control for boat engines. However I am stuck at the moment, I want it to write the average values (average value, maximum values and minimum values) to a text file hourly/daily or whatever time i define. Below is some code..
This one works just fine, it writes current temperature to a text file once every second:
void CAnalogTag::StoreData (double dRawData, BOOL bLive)
{
double dValue;
EnterCriticalSection(&m_csAccess);
m_dPrevRawValue = m_dLatestRawValue;
m_dLatestRawValue = dRawData;
LeaveCriticalSection(&m_csAccess);
if (m_pSecondsBin && bLive)
m_pSecondsBin->StoreDataPoint(dRawData);
std::ofstream ScanFile ("scanfile.txt", std::ios_base::app);
ScanFile << "Temperature: " << dRawData << endl << "Offset: " << m_dOffset << "\n";
ScanFile.close();
}
""
That works just fine, I think below is where the values that i want are stored, but I don't know how or if it's even possible to extract them:
""
void CAnalogTag::StoreData(void *pData, void *pMinData, void *pMaxData, long nNumPts, int nTrendType)
{
CArray<double, double&=""> *pTrendData = (CArray<double,double&> *)pData;
CArray<double, double&=""> *pMinTrendData = (CArray<double,double&> *)pMinData;
CArray<double, double&=""> *pMaxTrendData = (CArray<double,double&> *)pMaxData;
// store an entire array of data to the bin
switch (nTrendType)
{
case trend_seconds:
if (m_pSecondsBin)
m_pSecondsBin->SetEntireTrend(pTrendData, pMinTrendData, pMaxTrendData, nNumPts);
break;
case trend_minutes:
if (m_pMinutesBin)
m_pMinutesBin->SetEntireTrend(pTrendData, pMinTrendData, pMaxTrendData, nNumPts);
break;
case trend_hours:
if (m_pHoursBin)
m_pHoursBin->SetEntireTrend(pTrendData, pMinTrendData, pMaxTrendData, nNumPts);
break;
case trend_days:
if (m_pDaysBin)
m_pDaysBin->SetEntireTrend(pTrendData, pMinTrendData, pMaxTrendData, nNumPts);
break;
}
}
""
Any help would be appreciated.. Been stuck here for the last few days, and i think my boss is losing his patience
Cheers,
Nalle
|
|
|
|
|
i'm a layman for VC++, can anyone be kind to recommend me a book for accidence.thanks a lot
|
|
|
|
|
Microsoft Press books can be preferred.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
thank you
|
|
|
|
|
Do you want to learning VC
whitesky
|
|
|
|
|
I used IHTMLBodyElement to set the background picture,but I can't set the repeat property,and background-position-x,background-position-y.
What can I do?
|
|
|
|
|
I have solved the problem.
;)
|
|
|
|
|
I'm trying to learn C++, so I'm just building some sample classes to get some experience. I have a matrix class in which I have implemented an addition operator that looks like this...
matrix operator + (matrix& toAdd)
{
// Create a zero matrix to output.
matrix output = matrix(toAdd.get_rows(), toAdd.get_cols(), 0);
// A temporary variable for the sum of each element
double val;
// Go through every element and add them together
// Stick the result in the output matrix
for(int i = 0; i < nrows; i++)
{
for(int j = 0; j < ncols; j++)
{
// The array indices are always 1 less
// than the row or column number
val = elements[i][j] + toAdd.get_el(i+1,j+1);
output.set_el(i+1, j+1, val);
}
}
return output;
}
It's nothing fancy... hopefully you won't need to see the whole class to understand the problem.
I wanted to pass it a matrix by reference in case the matrix is huge. I figure it'd probably be good form to add a const so that it is
matrix operator + (const matrix& toAdd)
but if I add that in, it doesn't compile. I get errors like
"passing 'const matrix' as 'this' argument of 'int matrix::get_rows()' discards qualifiers"
I get one of those errors for every time I use a member function of toAdd. Without const, everything's fine, but the matrix referred to as toAdd is vulnerable to changes. I am using gcc (or, more accurately, g++) to compile. Let me know if you need more information. Thanks!
-Mark
|
|
|
|
|
a const object can handled by a member function qualified by const
never say die
|
|
|
|
|
change your prototype into :
matrix operator + (const matrix& toAdd) const
for the same, if you say that the parameter toAdd is const , then toAdd.get_el() will crash if matrix::get_el() is not defined as const member function
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
MALDATA wrote: "passing 'const matrix' as 'this' argument of 'int matrix::get_rows()' discards qualifiers"
Make the get member functions const:
int matrix::get_rows() const<br />
{ ... }
You can only call const methods on a const object.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
codes here:
//////////////////////////////////////
// fill the screen with pure color
CWindowDC dc(NULL);
CRect rect;
GetWindowRect(&rect);
CBrush br;
br.CreateSolidBrush(RGB(255, 0, 0));
dc.FillRect(&rect);
the problem is :
I want to recover to the status that the screen is not filled , how to recover?
does InvalidateRect can do it ?
why I refresh the desktop, the screen is recovered to the old style?
please give me some help, waiting for answers online!
my Email is : xuwenq88@126.com
Just my interest for these common things
|
|
|
|
|
|
Simply to repaint the desktop use this
::InvalidateRect(0, NULL, TRUE);
nave
|
|
|
|
|
hello everyone!
I have just started learning VC++. Can anyone suggest me a good book for starting with VC++. I know C++ well. I dont have any idea of MFS, SDK etc.
Plz suggest me something,
Thanks,
|
|
|
|
|
I suggest posting this in the VC++/MFC forum. I am certain you'll get a lot of suggestions there.
Would help to know your technical/coding background.
|
|
|
|
|
This is the Visual C++ / MFC forum
|
|
|
|
|
Guess I was the one confused. Thought I was in suggestions at the time.
|
|
|
|
|
|
I'll second that recommendation. Best getting started book on MFC for any level programmer. Problem is it's out of print but worth the price the used copies are going for nowadays.
|
|
|
|
|
Which Book is in out of print, I hope u r not mentioned clearly.
|
|
|
|