How to merge cell via excel buffer

kiyac
Member Posts: 118
I would like to merge cell A1 and cell A2,
where A1 = company name, A2 = null
What I need to add in excel buffer and what coding that I should add in report?
Thanks!
where A1 = company name, A2 = null
What I need to add in excel buffer and what coding that I should add in report?
Thanks!
0
Comments
-
I created a function with Local Parameters:
Var Name DataType Subtype Length
No RowNo Integer
No ColumnNo Integer
No CellValue Text 250
No MyBold Boolean
No MyUnderLine Boolean
No MyNumberFormat Text 30
No MyMergeCells Boolean
No MyStartMergeCell Text 30
No MyEndMergeCell Text 30
No MyAlignment Option
This function creates the merge cell entry in the excel buffer
EnterMergeCell(RowNo : Integer;ColumnNo : Integer;CellValue : Text[250];MyBold : Boolean;MyUnderLine : Boolean;etc.)INIT; VALIDATE("Row No.",RowNo); VALIDATE("Column No.",ColumnNo); "Cell Value as Text" := CellValue; Formula := ''; Bold := MyBold; Underline := MyUnderLine; NumberFormat := MyNumberFormat; "Merge Cells" := MyMergeCells; "Start Merge At Cell" := MyStartMergeCell; "End Merge at Cell" := MyEndMergeCell; Alignment := MyAlignment; INSERT;
I also created a function for EnterCell with the same pararmeters but not the merge values
In the createsheet function I added in the section
IF FIND('-') THEN BEGIN
REPEAT
...
IF Underline THEN
XlWrkSht.Range(xlColID + xlRowID).Borders.Item(XlEdgeBottom).LineStyle := XlContinuous;
right after the above I added this codeIF "Merge Cells" THEN XlWrkSht.Range("Start Merge At Cell"+':'+"End Merge at Cell").Merge;
In the report I had to figure out how many cells I needed to merge to accomodate my text length.
for exampleExcelBuf.EnterMergeCell(RowNo,1,VendorName,TRUE,FALSE,'', TRUE,'A'+FORMAT(RowNo),'D'+FORMAT(RowNo),1);
Steve0 -
do we need add "merge cell" column in excel buffer?
i'm using nav 5 sp 1, and i don't have that column0 -
INIT; VALIDATE("Row No.",RowNo); VALIDATE("Column No.",ColumnNo); "Cell Value as Text" := CellValue; Formula := ''; Bold := MyBold; Underline := MyUnderLine; NumberFormat := MyNumberFormat; "Merge Cells" := MyMergeCells; "Start Merge At Cell" := MyStartMergeCell; "End Merge at Cell" := MyEndMergeCell; Alignment := MyAlignment; INSERT;
are you sure about this code?
do we add it in Table Excel Buffer or report we want to export to excel?
because I have error message here"Merge Cells" := MyMergeCells; "Start Merge At Cell" := MyStartMergeCell; "End Merge at Cell" := MyEndMergeCell; Alignment := MyAlignment;
excell buffer doesn't have "merge cells"0 -
I'd do it like this:
PROCEDURE MergeRange(FromRow : Integer;FromCol : Integer;ToRow : Integer;ToCol : Integer); VAR FromRec : Record 370; ToRec : Record 370; BEGIN FromRec.VALIDATE("Row No.",FromRow); FromRec.VALIDATE("Column No.",FromCol); ToRec.VALIDATE("Row No.",ToRow); ToRec.VALIDATE("Column No.",ToCol); XlWrkSht.Range(FromRec.xlColID + FromRec.xlRowID + ':' + ToRec.xlColID + ToRec.xlRowID).Merge; END;
Then after you created the sheet and before you save it away or give the user control call that function.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