Excel Export

Hi All,

I was trying to use the excel buffer table to export some data onto an already created spreadsheet formatted with fonts, sizes etc. I have found the code in the export account schedules which seems to work well enough, my code is underneath, however the problem I have found with it, is that it wipes out all Borders defined on the spreadsheet!!.

Does anybody know how to add borders?

Has anybody got an example of this?

GrecExcel.OpenBook(GtxtFile,GtxtSheet);
GrecExcel.CreateSheet(GtxtSheet,’’,COMPANYNAME,USERID);

GrecExcel.GiveUserControl;

You can add a function to the excel buffer table.
Call It : SetBorderStyle

SetBorderStyle() : Integer
//>>Border
CASE “Border Style” OF
“Border Style”::xlLineStyleNone:
BEGIN
EXIT(-4142);
END;
“Border Style”::xlContinuous:
BEGIN
EXIT(1);
END;
“Border Style”::xlDash:
BEGIN
EXIT(-4115);
END;
“Border Style”::xlDashDot:
BEGIN
EXIT(4);
END;
“Border Style”::xlDashDotDot:
BEGIN
EXIT(5);
END;
“Border Style”::xlDot:
BEGIN
EXIT(-4118);
END;
“Border Style”::xlDouble:
BEGIN
EXIT(-4119);
END;
“Border Style”::xlSlantDashDot:
BEGIN
EXIT(13);
END;
ELSE
EXIT(-4142);
END;
//<<Border

Add a field Called:
50001 - Border Style - type option
Option String :xlLineStyleNone,xlContinuous,xlDash,xlDashDot,xlDashDotDot,xlDot,xlDouble,xlSlantDashDot

In the EnterCell Section of your report - you can set the boarder

EnterCell(RowNo : Integer;ColumnNo : Integer;CellValue : Text[250];Bold : Boolean;Italic : Boolean;UnderLine : Boolean) : Text[250]
TempExcelBuffer.INIT;
TempExcelBuffer.VALIDATE(“Row No.”,RowNo);
TempExcelBuffer.VALIDATE(“Column No.”,ColumnNo);
TempExcelBuffer.“Cell Value as Text” := CellValue;
(Sample of adding a line under row 10)
IF Row = 10
THEN TempExcelBuffer.“Border Style” := 0
ELSE TempExcelBuffer.“Border Style” := 1;

TempExcelBuffer.NumberFormat := ‘0’;
TempExcelBuffer.Formula := ‘’;
TempExcelBuffer.Bold := Bold;
TempExcelBuffer.Italic := Italic;
TempExcelBuffer.Underline := UnderLine;
TempExcelBuffer.INSERT;

recommend c#/.net excel component: Spire.XLS for .NET

recommend c#/.net doc component: Spire.Doc for .NET

http://www . e-iceblue . com/Introduce/excel-for-net-introduce.html

http://www . e-iceblue . com/Introduce/word-for-net-introduce.html

Hi Stephen,

basically that is spam. If you want to re-write it as a helpful post, then fine, but spam is not going to happen. I have broken the links.

If you want to be a part of the community, write an introduction post in the intro forum, and tell us about you and your products and how they can help with Navision, but don’t hide links in a thread like that.

if you don’t reply, I will assume this to be just a bot.