NAV 2018 Excel buffet of dotnet, how to set a row height?

chiosan
Member Posts: 5
Hi, I am currently upgrading my client's 2009 classic to 2018, and there's some excel export report.
The report needs to set fixed column width ,row height and zoom, in 2009 using automation is simple like:
But it's no longer working in 2018 using dotnet. I could found a function "XlWrkShtWriter.SetColumnWidth" to do the column width and it works.
However there isn't one for row height and zoom. Could anyone give me some advice? Many thanks.
The report needs to set fixed column width ,row height and zoom, in 2009 using automation is simple like:
SetHeight(pHeight : Decimal) IF pHeight > 0 THEN XlWrkSht.Range('A' + FORMAT(1) + ':' + xlColID + xlRowID).RowHeight := pHeight; SetWidth(pColmunID : Code[10];pWidth : Decimal) IF (pColmunID <> '') AND (pWidth > 0) THEN XlWrkSht.Range(pColmunID + FORMAT(1)).ColumnWidth := pWidth; SetZoom(pZoom : Integer) XlWrkSht.PageSetup.RightHeader :=''; IF pZoom > 0 THEN XlWrkSht.PageSetup.Zoom := pZoom;
But it's no longer working in 2018 using dotnet. I could found a function "XlWrkShtWriter.SetColumnWidth" to do the column width and it works.
However there isn't one for row height and zoom. Could anyone give me some advice? Many thanks.
0
Best Answer
-
Hi,
You can find an example here:
https://forum.mibuso.com/discussion/73152/excel-buffer-with-extended-formatting
You will need to use 2 functions:
- Call SetRowsProperty() from your report
- Add WriteRowsProperties() to WriteSheet function.5
Answers
-
Hi,
You can find an example here:
https://forum.mibuso.com/discussion/73152/excel-buffer-with-extended-formatting
You will need to use 2 functions:
- Call SetRowsProperty() from your report
- Add WriteRowsProperties() to WriteSheet function.5 -
Thank AlexDen, it works perfectly. You are amazing.
Is there any luck that I can also set the default zoom rate?0 -
I think it's possible.
Try to change code in WriteSheetViews() function.
Now it adds freeze pane to the sheet.
You should get something like that:IF (FreezePaneColNo < 2) AND (FreezePaneRowNo < 2) AND (Zoom = 0) THEN EXIT; OpenXmlWorksheet := XlWrkShtWriter.Worksheet; IF ISNULL(OpenXmlWorksheet.SheetViews) THEN OpenXmlWorksheet.SheetViews := OpenXmlSheetViews.SheetViews(); OpenXmlSheetView := OpenXmlSheetView.SheetView(); //OpenXmlSheetView.TabSelected := OpenXmlBoolValue.BooleanValue(TRUE); // Properties to set sheet zoom > OpenXmlSheetView.ZoomScale := OpenXmlUInt32Value.FromUInt32(Zoom); OpenXmlSheetView.ZoomScaleNormal := OpenXmlUInt32Value.FromUInt32(Zoom); // Properties to set sheet zoom < OpenXmlSheetView.WorkbookViewId := OpenXmlUInt32Value.FromUInt32(0); IF (FreezePaneColNo < 2) AND (FreezePaneRowNo < 2) THEN BEGIN IF FreezePaneRowNo < 1 THEN FreezePaneRowNo := 1; IF FreezePaneColNo < 1 THEN FreezePaneColNo := 1; DummyExcelBuf.VALIDATE("Column No.", FreezePaneColNo); ColumnCode := DummyExcelBuf.xlColID; OpenXmlPane := OpenXmlPane.Pane(); ... END; WrkShtHelper.AppendElementToOpenXmlElement(OpenXmlWorksheet.SheetViews, OpenXmlSheetView); ...
Zoom is your new global variable0
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