How to add borders in Export to Excel?

chandrurec
Member Posts: 560
Hi all,
I am trying to add the boreders for the datas exported to excel.
So I try to make use of the function BorderAround function available in Excel Buffer table.
But When I try to run the excel , it is giving me the error
"The Automation Variable is not instantiated".
The coding I have given for Body section is as follows.
//ExcelBuf.CreateRangeName('Range',1,1);
ExcelBuf.StartRange;
ExcelBuf.AddColumn('Depot Code',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[1],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[2],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[3],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('Total',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[4],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[5],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[6],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('Total',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[7],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[8],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[9],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('Total',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.EndRange;
ExcelBuf.CreateRangeName('Range',1,1);
ExcelBuf.CreateRange('Range');
ExcelBuf.BorderAround('Range');
I think the sequnce I am calling the function is wrong.
If anyone know the correct sequence to make the BorderAround function to work,Kindly correct the code above or tell me the correct sequence.
Thanks in advance.
Regards,
Chandru.
I am trying to add the boreders for the datas exported to excel.
So I try to make use of the function BorderAround function available in Excel Buffer table.
But When I try to run the excel , it is giving me the error
"The Automation Variable is not instantiated".
The coding I have given for Body section is as follows.
//ExcelBuf.CreateRangeName('Range',1,1);
ExcelBuf.StartRange;
ExcelBuf.AddColumn('Depot Code',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[1],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[2],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[3],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('Total',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[4],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[5],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[6],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('Total',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[7],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[8],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn(gItemName[9],FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.AddColumn('Total',FALSE,'',TRUE,FALSE,TRUE,'');
ExcelBuf.EndRange;
ExcelBuf.CreateRangeName('Range',1,1);
ExcelBuf.CreateRange('Range');
ExcelBuf.BorderAround('Range');
I think the sequnce I am calling the function is wrong.
If anyone know the correct sequence to make the BorderAround function to work,Kindly correct the code above or tell me the correct sequence.
Thanks in advance.
Regards,
Chandru.
0
Comments
-
No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Hi Luc Van Dyck ,
I have searched in the link which you have sent. It contains queries for adding borders through automation and not uisng the BorderAround function of Excel Buffer.
Kindly let me know how to add borders using the BorderAround function in ExcelBuffer.
Thanks in advance.
Regards,
Chandru.0 -
I'm sorry to hear that my answer is not 100% exactly what you are looking for. But the link I mentioned, gives you the info to modify the Excel Buffer table, to get the same result. I can do this job for you, but then I have to send you an invoice for my work hours.No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0
-
Hi Luc,
By modifying the LineStyle, I go the output.
Thanks a lot.
Regards,
Chandru.0 -
Hi Folks
If you want to use the Excelbuf.BorderAround, this is an sample of the code.
ExcelBuf.CreateRangeName(ExcelBuf.GetExcelReference(8),1,5);
LInt_RowCounter := 5;
LInt_ColCounter := 1;
REPEAT
REPEAT
ExcelBuf.SetCurrent(LInt_RowCounter,LInt_ColCounter);
ExcelBuf.StartRange;
ExcelBuf.SetCurrent(LInt_RowCounter,LInt_ColCounter);
ExcelBuf.EndRange;
ExcelBuf.CreateRange(ExcelBuf.GetExcelReference(8));
ExcelBuf.BorderAround(ExcelBuf.GetExcelReference(8));
LInt_ColCounter := LInt_ColCounter + 1;
UNTIL LInt_ColCounter > (GInt_ColCounter + 1);
LInt_ColCounter := 1;
LInt_RowCounter := LInt_RowCounter + 1;
UNTIL LInt_RowCounter > (GInt_RowCounter + 1);
Tan Eng Siong0 -
I use BorderStyle here:
IF Row < 10
THEN TempExcelBuffer."Border Style" := 0
ELSE TempExcelBuffer."Border Style" := 1;
http://www.youtube.com/watch?v=WQ63cFCPBOQ
From:
viewtopic.php?f=23&t=45618
just to add some more info.0 -
Hi engsiong75
,
I am getting an error like The automation Variable has not initiated ](*,) . Please can u guide me through it? :?: Can i use the same code to create boarder for all variable which i am inserting into excel :-k , ie all entries in excel is inside a box...0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions