Word Document save as html
Lgoo
Member Posts: 45
Hi,
i try to save a word document as html format. But how can i create a instance of "Microsoft.Officce.Interop.Word.WdSaveFormat"? I need this enum for the function:
i try to save a word document as html format. But how can i create a instance of "Microsoft.Officce.Interop.Word.WdSaveFormat"? I need this enum for the function:
WordDocument.SaveAs2();
0
Answers
-
Create a DotNet instance of that type and pass it to SaveAs2.
Paste the following snip into a text file and import as a codeunit, you can the copy the variable decl to your own object. The WdSaveFormat type is a simple enum tha tcan be handled with the normal DotNet support in AL. If you have top use more than a few office interop functions, I will strongly recommend to add a C# wrapper assembly that encapsulates the requried fucntions in an API that can be used in AL without adding the full parameter list.OBJECT Codeunit 50000 wdFormatHTML { OBJECT-PROPERTIES { Date=; Time=; Version List=; } PROPERTIES { OnRun=VAR WdSaveFormat@1000 : DotNet "'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.Microsoft.Office.Interop.Word.WdSaveFormat"; WordDocument@1001 : DotNet "'Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.Microsoft.Office.Interop.Word.Document"; BEGIN WdSaveFormat := WdSaveFormat.wdFormatHTML; //WordDocument.SaveAs2( // ref System.Object FileName, ref System.Object FileFormat, ref System.Object LockComments, // ref System.Object Password, ref System.Object AddToRecentFiles, ref System.Object WritePassword, // ref System.Object ReadOnlyRecommended, ref System.Object EmbedTrueTypeFonts, ref System.Object SaveNativePictureFormat, // ref System.Object SaveFormsData, ref System.Object SaveAsAOCELetter, ref System.Object Encoding, // ref System.Object InsertLineBreaks, ref System.Object AllowSubstitutions, ref System.Object LineEnding, // ref System.Object AddBiDiMarks, ref System.Object CompatibilityMode) END; } CODE { BEGIN END. } }_________________
Niels-Henrik Sejthen
Senior Software Developer
Microsoft Dynamics NAV
The information in this post is provided "AS IS" with no warranties, and confers no rights. This post does not represent the thoughts, intentions, plans or strategies of my employer. It is solely my opinion.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 328 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