I am trying to use the WordDocumentWriter. I am struggling to understand why the control is not available . How can I add the reference. I see it as if it is added, but I can not see the control in my Toolbox..
Imports Infragistics.Win.UltraWinGridImports Infragistics.Win.LayoutImports Infragistics.Win.UltraWinGrid.WordWriterImports System.Text.RegularExpressionsImports Infragistics.Documents.ExcelImports Infragistics.Documents.IO '' This gives an green line error ..Dim wordDocWriter As WordDocumentWriter = WordDocumentWriter.Create("C:\Samples_Projects\GridDataInWord.docx")wordDocWriter.StartDocument()wordDocWriter.StartParagraph()Dim font As Infragistics.Documents.Word.Font = wordDocWriter.CreateFont()font.Bold = Truefont.Underline = Underline.Thickfont.ForeColor = Color.Red
Hello Marius,
I am just checking about the progress of this issue. Let me know if you need my further assistance on it.
Thank you for using Infragistics Components.
Thank you for your feedback.
Here is the answers to your questions:
To create a MS Word document you only need to import Infragistics.Documents.Word. Please note you need to add references to Infragistics4.Documents.IO assembly.
Please note if you need to export from UltraGrid for example you need to add UltraGridWordWriter from the toolbox to your form. This will add all the necessary references to your solution.
If you receive Ambiguous reference error you have provided a name that is ambiguous and therefore conflicts with another name. The Visual Basic compiler does not have any conflict resolution rules; you must disambiguate names yourself. To correct this error you can fully qualify the name. This may occur also if you have added same references of Infragistics WinControls but from different version, e.g. if you have added Infragistics4.Documents.IO.v.14.1 and in the same time Infragistics4.Documents.IO.v.13.2 you will receive this error. What you need to do is to remove one of the reference files.
You may use several additional imports if you need to. This should not give you Ambiguous reference error, if they are from one version of Infragistics WinForms controls.
Please find attached sample solution implementing your WriteParagraph sub.
Please let me know if need my further assistance.
Thank you for contacting Infragistics.
Hi , thanks for your response.
Some questions:
I pasted the code below.
Private Sub WriteParagraph(writer As WordDocumentWriter, text As String, font As Infragistics.Documents.Word.Font)
' Open a paragraph writer.StartParagraph()
' Add a text run with the specified text and font writer.AddTextRun(text, font)
' Close the paragraph. writer.EndParagraph()End Sub
It says that the WordDocumentWriter has not been defined!
You are on the right way of using WordDocumentWriter. Please note WordDocumentWriter is an abstract class in Infragistics WinForms library and it is not a control or component. This is why you cannot see is in your toolbox. More about WordDocumentWriter you can find by following next link http://help.infragistics.com/Doc/WinForms/current/CLR4.0/?page=Word_About_Infragistics_Word_Library.html
Please note WordDocumentWriter is abstract class and does not support direct instantiation. To create an instance of a derived class you need to use Create method. One more point – each time you start document or paragraph by StartDocument() or StartParagraph() methods when you finish with them you need to call EndParagraph() and EndDocument() in order to avoid an exception.
This row Imports Infragistics.Documents.IO gives you an error as Infragistics.Documents.IO library does not contains any public methods.
Please find attached a sample solution implementing MS Word document creation via WordDocumentWriter.
Please let me know in this is what you are looking for or if I am missing something.