Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
hi.
qvw generate test.txt,test.txt are saved to the local.
save test.txt to server.I can't find a way to set it ,
Are there any other methods?
thanks!
maro:
sub Writes
Const ForAppending=8,TristateFalse=0
Set fso= CreateObject("Scripting.FileSystemObject")
fso.CreateTextFile("c:/test" & ".txt") '默认是桌面
set sfile=fso.OpenTextFile("c:/test.txt",ForAppending,TristateFalse)
set val=ActiveDocument.Fields("[QlikView User]").GetPossibleValues
for i=0 to val.Count-1
user=user&val.Item(i).Text
next
sfile.WriteLine "用户为:"&user
set table = ActiveDocument.GetSheetObject( "CH01" )
sfile.WriteLine "明细表的行数为:"&table.GetRowCount-1 '把表头去掉
sfile.WriteLine "明细表"
CellRect = ActiveDocument.GetApplication().GetEmptyRect()
CellRect.Top = 0
CellRect.Left = 0
CellRect.Width = table.GetColumnCount
CellRect.Height = table.GetRowCount
set CellMatrix = table.GetCells( CellRect )
set CellMatrix = table.GetCells( CellRect )
for RowIter=CellRect.Top to CellRect.Height-1
for ColIter=CellRect.Left to CellRect.Width-1
sfile.Write CellMatrix(RowIter)(ColIter).Text&" "
next
sfile.WriteLine "" '换行
next
sfile.Close
set fso=Nothing
set sfile=Nothing
end sub
Is "Allow macro execution on server" on the Enterprise Management Console > Server > Security turned on ?
Jonathan
You can't save a file on the server through a regular macro as macros are executed client side.
A way you could do this is by calling serversideexport on an chart object.
hi Daniel Rozental
Can you give an example for me?
thanks
QlikView reference manual has this to say:
"It is possible to export the content of any chart to a text file on the server by using a Macro connected to a Button. This feature has to be added in the QlikView document and then the macro can be executed from the QlikView Server directly in the web browser."
The API Guide has the following example on a StraightTableBox Class's ServerSideExport member:
set tb = ActiveDocument.GetSheetObject("CH01")
tb.ServerSideExport "C:\test.skv" , ";" , 0 'ANSI
Jonathan