编程

利用wxwidgets操纵word

我爱IT资讯库   2021/02/22

最近在学习怎么用wxwidgets来操纵word,寻找之中发现MedeoSoftware,里面有很多wxwidgets的用法,不过我最关心的还是其中的dmxMSWordDocument,操作word的方法比较全,很值得学习。代码如下(并附上全部源码):

 

 

dmxMSWordDocument.h

#ifndef _DMX_MSWORD_DOCUMENT_H_
#define _DMX_MSWORD_DOCUMENT_H_

#include "wxCommon.h"

////////////////////////////////////////////////////////////////////////////////
// dmxMSWordFont
////////////////////////////////////////////////////////////////////////////////

struct dmxMSWordFont
{
	long pointsize;
	bool bold;
	bool italic;
	wxString font_name;
	wxColour color;

	dmxMSWordFont(long a_pointsize = 12, bool a_bold = false, bool a_italic = false,
				  const wxString &ar_font_name = "Times New Roman",
				  const wxColour &ar_color = wxColour(0, 0, 0))
	:	pointsize(a_pointsize),
		bold(a_bold),
		italic(a_italic),
		font_name(ar_font_name),
		color(ar_color)
	{}

	dmxMSWordFont(const dmxMSWordFont &ar_font)
	:	pointsize(ar_font.pointsize),
		bold(ar_font.bold),
		italic(ar_font.italic),
		font_name(ar_font.font_name),
		color(ar_font.color)
	{}

	dmxMSWordFont& operator=(const dmxMSWordFont &ar_font)
	{
		if (&ar_font != this) {
			pointsize = ar_font.pointsize;
			bold = ar_font.bold;
			italic = ar_font.italic;
			font_name = ar_font.font_name;
			color = ar_font.color;
		}
		return *this;
	}

	bool operator==(const dmxMSWordFont &ar_font) const
	{
		if (pointsize != ar_font.pointsize ||
			bold != ar_font.bold ||
			italic != ar_font.italic ||
			font_name != ar_font.font_name ||
			color != ar_font.color)
			return false;
		else
			return true;
	}

	bool operator!=(const dmxMSWordFont &ar_font) const
	{
		return !operator==(ar_font);
	}
};

extern dmxMSWordFont gc_DefaultMSWordFont;

////////////////////////////////////////////////////////////////////////////////
// dmxMSWordDocument
////////////////////////////////////////////////////////////////////////////////

class dmxMSWordDocument
{
public: 
	enum Alignment
	{
		c_ALIGN_LEFT	= 0,
		c_ALIGN_CENTER	= 1,
		c_ALIGN_RIGHT	= 2,
		c_ALIGN_JUSTIFY	= 3
	};

	enum PageOrientation
	{
		c_PORTRAIT,
		c_LANDSCAPE
	};

private:
	bool m_ok;
	wxAutomationObject m_word;
	wxAutomationObject m_document;
	wxAutomationObject *mp_table;

	struct TableBufferElement
	{
		wxString Text;
		Alignment TextAlignment;
		dmxMSWordFont Font;
	};

	typedef std::vector<TableBufferElement> TableLineBuffer;
	std::vector<TableLineBuffer> m_table_buffer;
	
public:
	dmxMSWordDocument(const wxString &ar_name = wxEmptyString, bool a_visible = true);
	~dmxMSWordDocument();

	bool IsOk(void) const { return m_ok; }

	void Show(bool a_show = true);

	void Close(void);
	bool SaveAs(const wxString &ar_file_name);

	static bool IsAccessible(void);

	void AddParagraph(Alignment a_alignment = c_ALIGN_JUSTIFY, 
					  const dmxMSWordFont &ar_font = gc_DefaultMSWordFont);

	void AddTextParagraph(const wxString &ar_text, Alignment a_alignment = c_ALIGN_JUSTIFY,
						  const dmxMSWordFont &ar_font = gc_DefaultMSWordFont);

	void AddBitmap(const wxBitmap &ar_image, Alignment a_alignment = c_ALIGN_JUSTIFY);
	void AddPictureFromFile(const wxString &ar_file_name, Alignment a_alignment = c_ALIGN_JUSTIFY);

	bool CreateTableFromString(const wxString &ar_text, long a_cols, long a_rows,
							   const wxChar *ap_separator = "|",
							   long a_table_format1 = 22, // 耱桦纛痨囹桊钼囗 22 = "彦蜿蜞犭桷7"
							   long a_table_format2 = 16); // 羼腓 礤 镱塍麒腩顸, 蝾 稃蜞屐 耱桦纛痨囹桊钼囗 16 = "彦蜿蜞犭桷1"

	void InitTableBuffer(long a_cols, long a_rows);
	void SetTableBufferCellText(long a_col, long a_row, const wxString &ar_text,
								Alignment a_alignment = c_ALIGN_JUSTIFY, 
								const dmxMSWordFont &ar_font = gc_DefaultMSWordFont);
	bool CreateTableFromBuffer(void);

	void AddTable(long a_cols, long a_rows);
	void AddTableCellText(long a_col, long a_row, const wxString &ar_text,
						  Alignment a_alignment = c_ALIGN_JUSTIFY, 
						  const dmxMSWordFont &ar_font = gc_DefaultMSWordFont);
	void AddPictureToTableCell
	(
		long a_col, long a_row, 
		const wxString &ar_file_name,
		Alignment a_alignment
	);
	void AddBitmapToTableCell
	(
		long a_col, long a_row, 
		const wxBitmap &ar_bitmap,
		Alignment a_alignment
	);
	void PasteFromClipboardToTableCell
	(
		long a_col, long a_row, 
		Alignment a_alignment
	);
	
	void Paste(Alignment a_alignment);
	void SetPageOrientation(PageOrientation a_orientation);

	void SetPageLeftMargin(double a_margin_sm);
	void SetPageRightMargin(double a_margin_sm);
	void SetPageTopMargin(double a_margin_sm);
	void SetPageBottomMargin(double a_margin_sm);

	void SetPageHeaderDistance(double a_margin_sm);
	void SetPageFooterDistance(double a_margin_sm);

private:
	void mf_SetPageMargin(const wxString &ar_margin_name, double a_margin);
};

#endif

 

 

dmxMSWordDocument.cpp

#include "wxCommon.h"
#include "dmxMSWordDocument.h"
#include "Useful.h"
#include "message_dialog.h"
#include "wxTranslation.h"
#include "wxstringutil.h"

////////////////////////////////////////////////////////////////////////////////
// dmxMSWordFont
////////////////////////////////////////////////////////////////////////////////

dmxMSWordFont gc_DefaultMSWordFont = dmxMSWordFont();

////////////////////////////////////////////////////////////////////////////////
// dmxMSWordDocument
////////////////////////////////////////////////////////////////////////////////

dmxMSWordDocument::dmxMSWordDocument(const wxString &ar_name, bool a_visible)
:	m_ok(false),
	mp_table(NULL)
{
	// 青矬耜噱MSWord
	if (!m_word.CreateInstance("Word.Application"))
		return;

	m_ok = true;

	m_word.PutProperty("Visible", a_visible);
	m_word.CallMethod("Documents.Add");
	m_word.GetObject(m_document, "ActiveDocument");

	wxAutomationObject footer(m_document.CallMethod("Sections.Last.Footers.Item", 3L).GetVoidPtr());
	footer.CallMethod("PageNumbers.Add");

	if (!ar_name.IsEmpty())
		m_document.PutProperty("Name", ar_name);

	m_document.PutProperty("Content.Font.Name", gc_DefaultMSWordFont.font_name);
	m_document.PutProperty("Content.Font.Size", gc_DefaultMSWordFont.pointsize);
	m_document.PutProperty("Content.Font.Bold", gc_DefaultMSWordFont.bold);
	m_document.PutProperty("Content.Font.Italic", gc_DefaultMSWordFont.italic);
	m_document.PutProperty("Content.Font.Color", (long)RGB(gc_DefaultMSWordFont.color.Red(), 
														gc_DefaultMSWordFont.color.Green(), 
														gc_DefaultMSWordFont.color.Blue()));
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::Show(bool a_show)
{
	m_word.PutProperty("Visible", a_show);
	m_word.CallMethod("Word.ActiveWindow.Activate");
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::Close(void)
{
	m_word.CallMethod("Quit", false);
}

//------------------------------------------------------------------------------

bool dmxMSWordDocument::SaveAs(const wxString &ar_file_name)
{
	m_document.CallMethod("SaveAs", ar_file_name);
	return true;
}

//------------------------------------------------------------------------------

dmxMSWordDocument::~dmxMSWordDocument()
{
	if (mp_table) {
		delete mp_table;
		mp_table = NULL;
	}
}

//------------------------------------------------------------------------------

bool dmxMSWordDocument::IsAccessible(void)
{
	wxAutomationObject word;
	bool accessible = word.CreateInstance("Word.Application");
	if (accessible)
		word.CallMethod("Word.Close");

	return accessible;
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::AddParagraph(Alignment a_alignment, const dmxMSWordFont &ar_font)
{
	m_document.CallMethod("Content.InsertParagraphAfter");

	wxAutomationObject paragraph;
	m_document.GetObject(paragraph, "Paragraphs.Last");

	paragraph.PutProperty("Alignment", long(a_alignment));
	paragraph.PutProperty("SpaceAfter", long(0));
	paragraph.PutProperty("SpaceBefore", long(0));

	paragraph.PutProperty("Range.Font.Name", ar_font.font_name);
	paragraph.PutProperty("Range.Font.Size", ar_font.pointsize);
	paragraph.PutProperty("Range.Font.Bold", ar_font.bold);
	paragraph.PutProperty("Range.Font.Italic", ar_font.italic);
	paragraph.PutProperty("Range.Font.Color", (long)RGB(ar_font.color.Red(), 
														ar_font.color.Green(), 
														ar_font.color.Blue()));
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::AddTextParagraph(const wxString &ar_text, Alignment a_alignment,
										 const dmxMSWordFont &ar_font)
{
	m_document.CallMethod("Content.InsertAfter", ar_text);

	wxAutomationObject paragraph;
	m_document.GetObject(paragraph, "Paragraphs.Last");

	paragraph.PutProperty("Alignment", long(a_alignment));
	paragraph.PutProperty("SpaceAfter", long(0));
	paragraph.PutProperty("SpaceBefore", long(0));

	paragraph.PutProperty("Range.Font.Name", ar_font.font_name);
	paragraph.PutProperty("Range.Font.Size", ar_font.pointsize);
	paragraph.PutProperty("Range.Font.Bold", ar_font.bold);
	paragraph.PutProperty("Range.Font.Italic", ar_font.italic);
	paragraph.PutProperty("Range.Font.Color", (long)RGB(ar_font.color.Red(), 
														ar_font.color.Green(), 
														ar_font.color.Blue()));

	AddParagraph();
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::AddBitmap(const wxBitmap &ar_bitmap, Alignment a_alignment)
{
	wxOpenClipboard();
	wxEmptyClipboard();
	wxSetClipboardData(wxDF_BITMAP, &ar_bitmap, ar_bitmap.GetWidth(), ar_bitmap.GetHeight());
	wxCloseClipboard();

	Paste(a_alignment);
}


//------------------------------------------------------------------------------

void dmxMSWordDocument::AddPictureFromFile(const wxString &ar_file_name, Alignment a_alignment)
{
	m_document.CallMethod("Content.InsertAfter", wxEmptyString);

	wxAutomationObject paragraph;
	if (!m_document.GetObject(paragraph, "Paragraphs.Last"))
		return;

	paragraph.PutProperty("Alignment", long(a_alignment));
	paragraph.PutProperty("SpaceAfter", long(0));
	paragraph.PutProperty("SpaceBefore", long(0));
	wxVariant range = paragraph.GetProperty("Range");

	wxAutomationObject shapes;
	m_document.GetObject(shapes, "InlineShapes");

	wxVariant no_link_to_file(false);
	wxVariant save_with_document(true);
	shapes.CallMethod("AddPicture", ar_file_name, no_link_to_file, save_with_document, range);
}

//------------------------------------------------------------------------------

bool dmxMSWordDocument::CreateTableFromString(const wxString &ar_text, 
											  long a_cols, long a_rows,
											  const wxChar *ap_separator,
											  long a_table_format1,
											  long a_table_format2)
{
	wxAutomationObject paragraph;
	m_document.GetObject(paragraph, "Paragraphs.Last");

	paragraph.CallMethod("Range.InsertAfter", ar_text);

	std::vector<wxVariant> args;
	args.push_back(wxVariant(dmxT("|"), dmxT("Separator")));
	args.push_back(wxVariant(a_rows, dmxT("NumRows")));
	args.push_back(wxVariant(a_cols, dmxT("NumColumns")));
	args.push_back(wxVariant(true, dmxT("AutoFit")));
	args.push_back(wxVariant(0L, dmxT("AutoFitBehavior")));
	args.push_back(wxVariant(1L, dmxT("DefaultTableBehavior")));

	wxVariant result;
	if (a_table_format1 < 0)
	{
		// 杨玟噱蜞犭桷纛痨囹铎 镱 箪铍鬣龛
		paragraph.CallMethod("Range.ConvertToTable", args.size(), &(args[0]));
	}
	else
	{
		// 消蜞屐 耦玟囹蜞犭桷镥疴 玎溧眄 纛痨囹铎
		args.push_back(wxVariant(a_table_format1, dmxT("Format")));
		result = paragraph.CallMethod("Range.ConvertToTable", args.size(), &(args[0]));
		if (result.IsNull()) 
		{
			// 羼腓 礤 镱塍麒腩顸, 蝾 稃蜞屐 耦玟囹怛铕 玎溧眄 纛痨囹铎
			args.back() = wxVariant(a_table_format2, dmxT("Format"));
			if (a_table_format2 > 0)
				result = paragraph.CallMethod("Range.ConvertToTable", args.size(), &(args[0]));

			if (result.IsNull())
				// 眢, 珥圜栩, 耦怦屐 礤 镱塍麒腩顸
				return false;
		}
	}

	AddParagraph();

	return true;
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::InitTableBuffer(long a_cols, long a_rows)
{
	m_table_buffer.resize(a_rows, TableLineBuffer(a_cols, TableBufferElement()));
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::SetTableBufferCellText(long a_col, long a_row, 
											   const wxString &ar_text,
											   Alignment a_alignment, 
											   const dmxMSWordFont &ar_font)
{
	TableBufferElement element;
	element.Text = ar_text;
	element.Font = ar_font;
	element.TextAlignment = a_alignment;

	m_table_buffer[a_row][a_col] = element;
}

//------------------------------------------------------------------------------

bool dmxMSWordDocument::CreateTableFromBuffer(void)
{
	dmxUInt32 rows = m_table_buffer.size();
	if (rows == 0)
		return true;

	dmxUInt32 cols = m_table_buffer[0].size();
	if (cols == 0)
		return true;

	// 灶痨桊箦耱痤牦 耦玟噱蜞犭桷
	wxString table_string;
	for (dmxUInt32 j = 0; j < rows; j++)
		for (dmxUInt32 i = 0; i < cols; i++) {
			table_string << m_table_buffer[j][i].Text;
			if (j < rows - 1  || i < cols - 1)
				table_string << '|';
		}

	if (!CreateTableFromString(table_string, cols, rows, "|")) {
		dmxMessageBox(NULL, wxTR("tr_WordDocument", "MsgCreateTableError"), dmxMessageDialog::c_ICON_ERROR);
		return false;
	}

	// 灶痨囹桊箦麇殛蜞犭桷
	wxVariant index = m_document.GetProperty("Tables.Count");
	wxAutomationObject table(m_document.CallMethod("Tables.Item", index).GetVoidPtr());

	for (dmxUInt32 j = 0; j < rows; j++)
		for (dmxUInt32 i = 0; i < cols; i++) {
			if (m_table_buffer[j][i].TextAlignment == c_ALIGN_JUSTIFY &&
				m_table_buffer[j][i].Font == gc_DefaultMSWordFont) 
				continue;
			
			wxAutomationObject cell(table.CallMethod("Cell", long(j + 1), long(i + 1)).GetVoidPtr());

			if (m_table_buffer[j][i].TextAlignment != c_ALIGN_JUSTIFY)
				cell.PutProperty("Range.Paragraphs.Alignment", long(m_table_buffer[j][i].TextAlignment));
			cell.PutProperty("Range.Paragraphs.SpaceAfter", long(0));
			cell.PutProperty("Range.Paragraphs.SpaceBefore", long(0));

			dmxMSWordFont font = m_table_buffer[j][i].Font;
			if (font.font_name != gc_DefaultMSWordFont.font_name)
				cell.PutProperty("Range.Font.Name", font.font_name);
			if (font.pointsize != gc_DefaultMSWordFont.pointsize)
				cell.PutProperty("Range.Font.Size", font.pointsize);
			if (font.bold != gc_DefaultMSWordFont.bold)
				cell.PutProperty("Range.Bold", font.bold);
			if (font.italic != gc_DefaultMSWordFont.italic)
				cell.PutProperty("Range.Font.Italic", font.italic);
			if (font.color!= gc_DefaultMSWordFont.color)
				cell.PutProperty("Range.Font.Color", (long)RGB(font.color.Red(), 
															   font.color.Green(), 
															   font.color.Blue()));
		}

	return true;
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::AddTable(long a_cols, long a_rows)
{
	if (mp_table) {
		delete mp_table;
		mp_table = NULL;
	}

	dmxMSWordFont dummy_font(6, false, false, "Arial");
	AddParagraph(dmxMSWordDocument::c_ALIGN_CENTER, dummy_font);

	wxAutomationObject paragraph;
	if (m_document.GetObject(paragraph, "Paragraphs.Last"))
	{
		paragraph.PutProperty("PointSize", long(6));
	}


	wxVariant args[3];
	args[0] = m_document.GetProperty("Paragraphs.Last.Range");
	args[1] = a_rows;
	args[2] = a_cols;

	m_document.CallMethod("Tables.Add", 3, args);

	wxVariant index = m_document.GetProperty("Tables.Count");
	mp_table = new wxAutomationObject(m_document.CallMethod("Tables.Item", index).GetVoidPtr());
	mp_table->PutProperty("Borders.InsideLineStyle", 1L);// = wdLineStyleSingle
    mp_table->PutProperty("Borders.OutsideLineStyle", 1L);
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::AddTableCellText(long a_col, long a_row, 
										 const wxString &ar_text, Alignment a_alignment, 
										 const dmxMSWordFont &ar_font)
{
	if (!mp_table)
		return;

	wxAutomationObject cell(mp_table->CallMethod("Cell", a_row, a_col).GetVoidPtr());
	
	cell.PutProperty("Range.Paragraphs.Alignment", long(a_alignment));
	cell.PutProperty("Range.Paragraphs.SpaceAfter", long(0));
	cell.PutProperty("Range.Paragraphs.SpaceBefore", long(0));

	if (ar_font != gc_DefaultMSWordFont) {
		cell.PutProperty("Range.Font.Name", ar_font.font_name);
		cell.PutProperty("Range.Font.Size", ar_font.pointsize);
		cell.PutProperty("Range.Bold", ar_font.bold);
		cell.PutProperty("Range.Font.Italic", ar_font.italic);
		cell.PutProperty("Range.Font.Color", (long)RGB(ar_font.color.Red(), 
													   ar_font.color.Green(), 
													   ar_font.color.Blue()));
	}

	cell.CallMethod("Range.InsertAfter", ar_text);
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::AddPictureToTableCell
(
	long a_col, long a_row, 
	const wxString &ar_file_name,
	Alignment a_alignment
)
{
	if (!mp_table)
		return;

	wxAutomationObject cell(mp_table->CallMethod("Cell", a_row, a_col).GetVoidPtr());
	cell.CallMethod("Range.InsertAfter", wxEmptyString);

	wxAutomationObject paragraph;
	if (!cell.GetObject(paragraph, "Range.Paragraphs.Last"))
		return;

	paragraph.PutProperty("Alignment", long(a_alignment));
	paragraph.PutProperty("SpaceAfter", long(0));
	paragraph.PutProperty("SpaceBefore", long(0));
	wxVariant range = paragraph.GetProperty("Range");

	wxAutomationObject shapes;
	m_document.GetObject(shapes, "InlineShapes");

	wxVariant no_link_to_file(false);
	wxVariant save_with_document(true);
	shapes.CallMethod("AddPicture", ar_file_name, no_link_to_file, save_with_document, range);
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::AddBitmapToTableCell
(
	long a_col, long a_row, 
	const wxBitmap &ar_bitmap,
	Alignment a_alignment
)
{
	if (!mp_table)
		return;

	wxAutomationObject cell(mp_table->CallMethod("Cell", a_row, a_col).GetVoidPtr());

	wxAutomationObject range;
	if (!cell.GetObject(range, "Range"))
		return;

	wxOpenClipboard();
	wxEmptyClipboard();
	wxSetClipboardData(wxDF_BITMAP, &ar_bitmap, ar_bitmap.GetWidth(), ar_bitmap.GetHeight());
	wxCloseClipboard();

	range.CallMethod("Paste");
	range.PutProperty("Alignment", long(a_alignment));
	range.PutProperty("SpaceAfter", long(0));
	range.PutProperty("SpaceBefore", long(0));
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::PasteFromClipboardToTableCell
(
	long a_col, long a_row, 
	Alignment a_alignment
)
{
	if (!mp_table)
		return;

	wxAutomationObject cell(mp_table->CallMethod("Cell", a_row, a_col).GetVoidPtr());

	wxAutomationObject range;
	if (!cell.GetObject(range, "Range"))
		return;

	range.CallMethod("Paste");
	range.PutProperty("Alignment", long(a_alignment));
	range.PutProperty("SpaceAfter", long(0));
	range.PutProperty("SpaceBefore", long(0));
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::Paste(Alignment a_alignment)
{
	wxAutomationObject paragraph;
	if (m_document.GetObject(paragraph, "Paragraphs.Last"))
	{
		paragraph.PutProperty("Alignment", long(a_alignment));
		paragraph.PutProperty("SpaceAfter", long(0));
		paragraph.PutProperty("SpaceBefore", long(0));
	}

	m_document.CallMethod("Paragraphs.Last.Range.Paste");
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::SetPageOrientation(PageOrientation a_orientation)
{
	wxAutomationObject page_setup;
	if (!m_document.GetObject(page_setup, "PageSetup"))
		return;

	page_setup.PutProperty("Orientation", long(a_orientation));
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::mf_SetPageMargin(const wxString &ar_margin_name, double a_margin_sm)
{
	wxAutomationObject page_setup;
	if (!m_document.GetObject(page_setup, "PageSetup"))
		return;

	// 1 濑殪 = 2,54 耢 = 72 蝾麝
	double margin_points = (a_margin_sm*72.0)/2.54;
	page_setup.PutProperty(ar_margin_name, margin_points);
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::SetPageLeftMargin(double a_margin_sm)
{
	mf_SetPageMargin("LeftMargin", a_margin_sm);
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::SetPageRightMargin(double a_margin_sm)
{
	mf_SetPageMargin("RightMargin", a_margin_sm);
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::SetPageTopMargin(double a_margin_sm)
{
	mf_SetPageMargin("TopMargin", a_margin_sm);
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::SetPageBottomMargin(double a_margin_sm)
{
	mf_SetPageMargin("BottomMargin", a_margin_sm);
}

//------------------------------------------------------------------------------

void dmxMSWordDocument::SetPageHeaderDistance(double a_margin_sm)
{
	mf_SetPageMargin("HeaderDistance", a_margin_sm);
}
//------------------------------------------------------------------------------

void dmxMSWordDocument::SetPageFooterDistance(double a_margin_sm)
{
	mf_SetPageMargin("FooterDistance", a_margin_sm);
}

////////////////////////////////////////////////////////////////////////////////

 

注:在使用ole时不要忘记包含头文件#include <wx/msw/ole/automtn.h>




热门内容

Python中的简单类型

整数 & 浮点数 整数有两种,分别是 int 和 long。其中 int 最大值是 2147483647... ...

JS-时间函数

/** * 日期范围工具类 */ var daterangeutil = (function () { /** ...
“大数据”信息平台 覆盖社区5000老年人

“大数据”信息平台 覆盖社区5000老年人

突然头疼脑热,身边没人照顾;电灯坏了、水管漏了,该找谁来帮忙修?菊园新区智慧养老项目搭建了一个为老综合服务平台... ...

在PHP中全局变量的使用详解

即使开发一个新的大型PHP程序,你也不可避免的要使用到全局数据,因为有些数据是需要用到你的代码的不同部分的。一些常见的全... ...

名称空间也可以自定义

名字空间的定义 名字空间除了系统定义的名字空间之外,还可以自己定义,定义名字空间用关键字namespace,使用名字空 ...
从量价变化中洞察主力意图

从量价变化中洞察主力意图

成份B指(399003.SZ) <script language="JavaScript" typ... ...
android 继承view类刷新页面【安卓进化十一】

android 继承view类刷新页面【安卓进化十一】

       最近做项目中发现,继承了view类的子类... ...

C# XmlSerializer 对象的Xml序列化和反序列化

    .Net程序执行时,对象都驻留在内存中;内存中的对象如果需要传递给其他系统使用;或者在... ...

hdu-1286找新朋友(欧拉函数,水题)

题目链接: 找新朋友 time limit: 2000/1000 ms (java/others)memory limi ...

java程序 处理 andrid本地帮助文档打开慢的方式

    下载本地的android自带sdk帮助文档由于有被墙的google地址,可以通... ...

RTTI学习笔记

翻看C++的书,对RTTI的讲解都很困惑,"你知道你的对象是哪个类吗","RTTI常用于调试和数据库程序"对这些讲... ...

使用axis2传输附件

服务端Service文件: import java.io.FileOutputStream; import jav... ...

sql server 的行转列

sql server中行转列在sql2005之后,sqlserver引入了pivot运算符,也即是可以旋转行为列,... ...
【Node.js基础篇】(九)使用readline模块实现Node.js的输入输出

【Node.js基础篇】(九)使用readline模块实现Node.js的输入输出

学C++的时候,有cout和cin,Java也有println和Scanner控件,Node.js也有如同... ...
iOS 应用支持4寸屏

iOS 应用支持4寸屏

iPhone 5出了,一大批应用要兼容新的分辨率,下载了Xcode 4.5,在官方那里找不到有关兼容新分辨... ...

循环执行oracle到mysql的迁移步骤及各种注意事项

改章节笔者在北京逛街的时候突然想到的...今天就有想写几篇关于循环执行的笔记,所以回家到之后就奋笔疾书的写出来发表了 ... ...
2015收获的季节

2015收获的季节

—————————————————————前言————————————————————— ———————... ...

JSP中的pageEncoding和contentType属性

关于JSP页面中的pageEncoding和contentType两种属性的区别: pageEncoding是js... ...

对XX证券报关于物联网操作系统的几个问题的答复

XX证券报提问了几个关于物联网和物联网操作系统的问题,个人表达了一些粗陋的观点,在这里发表出来,与行业朋友交流和探... ...
In语句优化

In语句优化

In语句的优化 现有两张表: CLINIC_ORGANISM 数据量:1400 LAB_DRUGRESISTITE... ...
fuzzysearch, 在JavaScript中,快速而快速的模糊搜索

fuzzysearch, 在JavaScript中,快速而快速的模糊搜索

源代码名称:fuzzysearch源代码网址:http://www.github.com/bevacqua/fuzzys ...

SQL Server里的 ISNULL 与 NULLIF

SQL Server 中有两个参数,语法:     ISNULL(check_... ...

判断SD是否存在及其容量查询

这个非常简单,直接上代码: MainActivity: package com.home.getsdinf... ...

Python:如何排序(sort)

一、前言 python的列表(list)有两个排序方法: 一种是内建的list.sort()方法,可以直接改变列表的内容 ...

boost库在工作(5)作用域智能指针scoped_ptr之四

第二种情况,主要就是使用在调用异常抛出的函数的地方。如下面的例子: //异常抛出的函数,适合使用智能指针... ...

Error:couldnotopen`C:\ProgramFiles\Java\jre6\lib\i386\jvm.cfg'

昨天刚过情人节!哈哈,好久没记录学习内容了,今天在房子闲着没事重新安装jdk,按道理很简单的; 第一步下载jdk; ...

第49周二

晚上总结下今天,主要是在完善用户需求文档,同时看了jquery相关的操作技巧,主要是想学习jquery源码,在知乎jqu ...

C++ #include 和 using std::string

今天,偶尔写了一个小小的程序,关于字符串问题程序。 比如,我想连续打印用户输入的字符串。 #include&l... ...

Struts Hibernate Spring 经典面试题

Hibernate工作原理及为什么要用? 原理: 1.读取并解析配置文件 2.读取并解析映射信息,创建Ses... ...

SAP Performance浅析

本文来源于:http://scnblogs.techweb.com.cn/tcsapbw/archives/106... ...