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   |
|
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 );
}
|
|
|
 |
|
[SEMI-SOLVED] OfficeAutomation : How to Set Hyperlink to a Excel cell?
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: koldo on Mon, 11 July 2011 17:25
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: koldo on Mon, 11 July 2011 23:03
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: ratah on Tue, 12 July 2011 14:44
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: ratah on Tue, 12 July 2011 14:46
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: koldo on Wed, 13 July 2011 09:50
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: koldo on Wed, 13 July 2011 15:37
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: koldo on Wed, 13 July 2011 17:05
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: koldo on Fri, 20 September 2013 10:35
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: ratah on Mon, 23 September 2013 13:22
|
 |
|
Re: OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: ratah on Wed, 13 July 2011 14:23
|
 |
|
Re: [SEMI-SOLVED] OfficeAutomation : How to Set Hyperlink to a Excel cell?
By: koldo on Mon, 23 September 2013 16:11
|
Goto Forum:
Current Time: Tue Jun 03 03:00:56 CEST 2025
Total time taken to generate the page: 0.02527 seconds
|