Skip to content

Instantly share code, notes, and snippets.

@HerbM
Created December 16, 2016 06:04
Show Gist options
  • Save HerbM/92a8869b5b3df750d92a93416dc308a6 to your computer and use it in GitHub Desktop.
Save HerbM/92a8869b5b3df750d92a93416dc308a6 to your computer and use it in GitHub Desktop.
OpenXML-test-errors
// OpenXML-test-errors OXML-1
open System.IO
open System.IO.Packaging
open DocumentFormat.OpenXml.Packaging
open DocumentFormat.OpenXml.Wordprocessing
[<EntryPoint>]
let Main args =
let byteArray = File.ReadAllBytes "Test.docx"
use mem = new MemoryStream()
mem.Write(byteArray, 0, (int)byteArray.Length)
do
use doc = WordprocessingDocument.Open(mem, true)
let para = new Paragraph()
let run = new Run()
let text = new Text("Newly inserted paragraph")
run.InsertAt(text, 0) |> ignore
para.InsertAt(run, 0) |> ignore
doc.MainDocumentPart.Document.Body.InsertAt(para, 0) |> ignore
use fs = new FileStream("Test2.docx", FileMode.Create)
mem.WriteTo(fs)
0
(*
Severity Code Description Project File Line
Error The namespace or module 'DocumentFormat' is not defined OXML c:\dev\F#\OXML\OXML\Program.fs 3
Error The namespace or module 'DocumentFormat' is not defined OXML c:\dev\F#\OXML\OXML\Program.fs 4
Error The namespace or module 'WordprocessingDocument' is not defined OXML c:\dev\F#\OXML\OXML\Program.fs 12
Error The type 'Paragraph' is not defined OXML c:\dev\F#\OXML\OXML\Program.fs 13
Error The type 'Run' is not defined OXML c:\dev\F#\OXML\OXML\Program.fs 14
Error The type 'Text' is not defined OXML c:\dev\F#\OXML\OXML\Program.fs 15
Error Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. OXML c:\dev\F#\OXML\OXML\Program.fs 16
Error Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. OXML c:\dev\F#\OXML\OXML\Program.fs 17
Error Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved. OXML c:\dev\F#\OXML\OXML\Program.fs 18
Warning Found conflicts between different versions of the same dependent assembly that could not be resolved. These reference conflicts are listed in the build log when log verbosity is set to detailed. OXML C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets 1820
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment