ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   my latest C++ excel OLE automation code (https://www.excelbanter.com/excel-programming/444062-re-my-latest-c-excel-ole-automation-code.html)

Lynn McGuire[_2_]

my latest C++ excel OLE automation code
 
// fm2n_old.h


#include <iostream
#include <string
#include <vector


extern std::string notebook;

extern std::string IniFileName;

extern int RunInTestMode;


const double uninitializedValue = -98765.4321;

const int defaultFirstColumnWidth = 25;
const int defaultOtherColumnWidth = 14;



// Excel Constants
const int xlCellTypeLastCell = 11;
const int xlThin = 2;
const int xlSolid = 1;
const int xlCenter = -4108;
const int xlBottom = -4107;
const int xlTop = -4160;
const int xlRight = -4152;
const int xlLeft = -4131;
const int xlNone = -4142;
const int xlContinuous = 1;
const int xlAutomatic = -4105;
const int xlExpression = 2;


extern std::string g_dimensionalUnits [MaxItemsInRow];
extern double * g_rows;
extern char g_aLine [100000];
extern char g_aLine2 [100000];
extern int g_numberOfRows;
extern int g_currentColumn;
extern const char * g_lineChunk [MaxLineChunks];
extern int g_numChunks;
extern char g_Fm2nbookTitle [];
extern int g_numberOfPages;

extern int RunInTestMode;

int MakeSureNotebookExists (std::string notebookName);
int ConnectToNotebook (std::string notebook, int runInTestMode, int firstTime);
int DisconnectFromNotebook (int runInTestMode);
void Fm2nbookGetStartupDir (void);
void ReportError (DWORD result, std::string job, std::string buffer);
void PutStringInServer (int row, int column, const char * str);
void PutStringInServer (int row, int column, std::string string);
void PutDoubleInServer (int row, int column, const double num);
void PutDoubleInServerVertical (int row, int column, int count, const double num []);
void PutDoubleInServerHorizontal (int row, int column, int count, const double num []);
void PutIntegerInServer (const int row, const int column, const int num);
int ConnectToNewSheet (std::string newSheetName, int createNewSheet, std::string baseSheetName, int deleteExistingSheet);
std::string GetCellEquivalent (const int row, const int column);
std::string GetCellRowEquivalent (const int row);
std::string GetCellColumnEquivalent (const int column);
void NameCellInServer (std::string cellName, std::string sheetName, const int row, const int column);
int ConnectToNewNoteBook (int caseNumber);
std::string GetExcelCurrentSelection (void);
void InitTable (int numberOfRows, int numberOfColumns);
void PutDoubleInTable (int numberOfDoubles, double * num);
void PutDoubleInTable (double num);
void PutStringInTable (std::string str);
void PutBlankInTable (int numberOfBlanks);
void PutIntegerInTable (int nunber);
void SendTableToServer (int row1, int column1, int row2, int column2);
double AsDouble (const char * str);
double AsDouble (std::string string);
void PutRowInTable (std::string title, std::string number, std::string units);
void PutRowInTable (std::string title, std::string number, std::string units, int offset);
void PutRow4InTable (std::string title, std::string units, std::string num1, std::string num2,
std::string num3, std::string num4, int offset);

std::string removeTrailingBlanks (std::string str);
int find (std::vector <int aList, int val);
int StartExcelServer (void);

std::vector <std::string getCellInfo (std::string sheetName, std::string column1, std::string column2,
std::string row1, std::string row2);
int putCellInfo (std::vector <std::string results, std::string sheetName, std::string column1,
std::string column2, std::string row1, std::string row2,
std::string dimensionalUnitsValue, int dimensionalUnitsPlacement);
int setRangeFont (std::string rangeValue, std::string fontNameValue, int boldValue, int sizeValue, int colorValue);
int SetRangeWidthAlignment (std::string rangeValue, int columnWidthValue, int horizontalAlignmentValue);


All times are GMT +1. The time now is 10:04 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com