-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxlSimpl.hs
31 lines (25 loc) · 942 Bytes
/
xlSimpl.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import System.Win32.Com
import System.Win32.Com.Automation
--
-- createObjectExcel
-- coming from Automation.hs and com.hs
--
xlWorkbookDefault, xlSaveChanges, xlDoNotSaveChanges :: Int
xlDoNotSaveChanges = 2
xlSaveChanges = 1
xlWorkbookDefault = 51
getText :: IDispatch a -> IO String
getText obj= obj # propertyGet_0 "Text"
fichierTest2 = "E:/Programmation/haskell/Com/qos.xls"
fichierTest = "C:/Users/lyup7323/Developpement/Haskell/Com/qos1.xls"
main = coRun $ do
pExl <- getFileObject fichierTest2 "Excel.Application"
workBook <- getObject fichierTest2
pExl # propertySet "DisplayAlerts" [inBool False]
workSheets <- workBook # propertyGet_0 "Worksheets"
sheetSel <- workSheets # propertyGet_1 "Item" "BIV"
rng <- sheetSel # propertyGet_1 "Range" "C7"
text <- rng # getText
putStrLn text
-- workBook # propertySet_1 "Saved" (1::Int)
workBook # method_1_0 "Close" xlDoNotSaveChanges