Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » UppHub » [SEMI-SOLVED] OfficeAutomation : How to Set Hyperlink to a Excel cell?
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell? [message #33181 is a reply to message #33180] Wed, 13 July 2011 14:05 Go to previous messageGo to previous message
sergeynikitin is currently offline  sergeynikitin
Messages: 748
Registered: January 2008
Location: Moscow, Russia
Contributor

My Code to work with OfficeAutomation:

void MainWindow::ExportExcel(){
	
	SelectColumnsDlg dlg;
	
	if(dlg.Execute() != IDOK)
		return;

	OfficeSheet sheet;
	String fn  = AppendFileName(GetDesktopFolder(), "Export.xls");
	bool openAvailable = sheet.IsAvailable("Open");
	bool microsoftAvailable = sheet.IsAvailable("Microsoft");
	if (openAvailable) {
		sheet.Init("Open");
	}
	if (microsoftAvailable) {
		sheet.Init("Microsoft");
	}

	//if (!sheet.OpenSheet(fn, true)) {
		sheet.AddSheet(true);
	//}	
	
	int col=1;
	#define eq(n,m,a) if (~dlg.n ==1) sheet.SetValue(col++, 1, m); a; 
	eq(opt_number,t_("Number"),)
	eq(opt_address,t_("Address"),sheet.SetColWidth(col-1, 60))
	eq(opt_time1,t_("Time from"),sheet.SetColWidth(col-1, 30))
	eq(opt_time2,t_("Time to"),sheet.SetColWidth(col-1, 30))
	eq(opt_price,t_("Price"),)
	eq(opt_tax,t_("Tax"),)
	eq(opt_makeprice,t_("Make price"),)
	eq(opt_maketax,t_("Make tax"),)
	eq(opt_size,t_("Size"),sheet.SetColWidth(col-1, 30))
	eq(opt_link,t_("Link"),sheet.SetColWidth(col-1, 30))
	eq(opt_status,t_("Status"),sheet.SetColWidth(col-1, 30))

	sheet.Select(1, 1, col-1, 1);
	sheet.SetBold(true);	
	
	int count=0;
	LOG("Start Export--------------------------");
	for(int i = 0; i < listobj.GetCount() ; i++) {
		String link = LinkCalc(listobj(i,OBJ_ID));
		if (listobj(i,Id("Select")) == 1) {
			int col=1;
			#undef eq
			#define eq(n,m) if (~dlg.n ==1) sheet.SetValue(col++, i+2, m);
			#define eq1(n,m) if (~dlg.n ==1) m;
			eq(opt_number,AsString(count+1))
			eq(opt_address,AsString(listobj(i,OBJ_ADDRESS)))
			eq(opt_time1,DateConvert().Format(listobj(i,OBJ_TIME_FROM)))
			eq(opt_time2,DateConvert().Format(listobj(i,OBJ_TIME_TO)))
			eq(opt_price,FormatL(listobj(i,OBJ_PRICE)))
			eq(opt_tax,AsString(listobj(i,OBJ_TAX)))
			eq(opt_makeprice,FormatL(listobj(i,OBJ_MAKEPRICE)))
			eq(opt_maketax,AsString(listobj(i,OBJ_MAKETAX)))
			eq(opt_size,AsString(listobj(i,OBJ_SIZE)))
			eq1(opt_link,sheet.SetValue(col++, i+2,"=HYPERLINK(\""+link+"\";\"Presentation\")"));
			eq(opt_status,AsString(listobj(i,OBJ_STATUS)))
			count++;
		}
		
	}
	PromptOK("End Export&"+AsString(count)+" lines exported");
	LOG("End Export----------------------------");
}


SergeyNikitin<U++>( linux, wine )
{
    under( Ubuntu || Debian || Raspbian );
}
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: AESStream and Core/SSL libraries
Next Topic: MAPIEx compilation problem in Win7
Goto Forum:
  


Current Time: Tue Jun 03 03:00:56 CEST 2025

Total time taken to generate the page: 0.02527 seconds