Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Notes document to HTML Excel sheet - Exporting data - web form

Code for exporting data from notes documents to an excel sheet and show it in html form of excel sheet:

Sub Initialize
 On Error Goto GenErr
 Print  "content-type: Application/msexcel"
 Print  "Content-Disposition: attachment; filename=Report1.xls"
 Print "<html>"
 Print "<table border=0>"
 Print "<tr><td colspan=5><center>"
 Print "<b><span id='RptHead'> Report For Test</span></b>"
 Print "</center></td></tr>"
 Print "</table>"


 Dim LOSession As New NotesSession
 Dim LOVw As NotesView
 Dim LODb As NotesDatabase
 Dim LODoc As notesdocument
 Dim LTDate As String
 Dim LVNo As Variant
 Set LODoc = LOSession.DocumentContext
 'LTDate=LODoc.Query(0)

 Set LODb=LOSession.CurrentDatabase
 Set LOVw = LODb.GetView( "vwExcel" )
 Set LODoc = LOVw.GetFirstDocument

 Print "<table border=2 bordercolor=Black>"
 Print "<tr>"
 Print "<td>Sl No </td>"
 Print "<td> Initiators</td>"
 Print "<td>KLID </td>"
 Print "<td>SBU </td>"

 Print "<td>Project Short Name </td>"
 Print "<td>Product Group </td>"
 Print "<td>Product </td>"
 Print "<td>Function </td>"
 Print "<td>LOB </td>"
 Print "<td>Rating by Experts </td>"
 Print "<td>Project Manager </td>"
 Print "<td>Proposal Manager </td>"

 Print "<td>Process Area </td>"
 Print "<td>Process Item </td>"
 Print "<td>Key Learning Title</td>"
 Print "<td>Problem Description </td>"
 Print "<td>Analysis </td>"
 Print "<td>Solution Adopted </td>"
 Print "<td>Learnings </td>"
 Print "<td>Implication </td>"
 Print "<td>DO's  List</td>"
 Print "<td>DONOT's List </td>"
 Print "<td>References </td>"

 Print "<td>Approver </td>"
 Print "<td>Comments </td>"

 Print "</tr>"
 Print "<tr>"
 Print "</tr>"

 j=1
 While Not ( LODoc Is Nothing )
 
  Print "<tr>"
  Dim LVTemp As Variant
  Print "<td>" & j &"</td>"
  For  i=0 To 23
   'LVTemp =  LODoc.ColumnValues( i )
   'Msgbox LVTemp
   'Print "<td>" & LVTemp & "</td>"
  
   Print "<td>" & LODoc.ColumnValues( i ) & "</td>"
  
  
  Next
  Print "</tr>"
  j=j+1
 
  Set  LODoc = LOVw.GetNextDocument(  LODoc )
 Wend

 Print "</table>"
 Exit Sub
GenErr:
 Msgbox "Error on SaveKtips agent , Error On line " & Erl & " Error is " & Error & " Err is " & Err
 Exit Sub

End Sub

To run an agent from lotus notes webpage

To run a Lotus-script agent from a lotus notes webpage:

1) Write @Command([ToolsRunMacro]; "(MyWebAgent)") in the button's programmer pane Client > Formula and it will work when you click the button. No need to do Pass-thru HTML for this button.

If for some reason you are still not able to achieve your result, you can use an indirect approach, i.e.

2) In your button where you have written the code for running the agent, in it's Properties > HTML tab, give a name  and id to it. It's better if we keep the value for Name and ID same.

Then create another Button or link and in that write in the programmer pane Web > Javascript, document.forms(0).<the button's ID value>.click()

i.e. document.forms(0).btnCheckDuplicate.click()

Thus, the first button will be triggered with the click() event and your agent will run.

Proper way to logout a website...

Proper way to logout is a website in lotus notes:

After you use the default logout code you must redirect the page to another page.
This way if a PC is being used by multiple users it will not open the same session.
Once you redirect to another page, it kills the session completely post logout.

Syntax:
top.location = self.location.href.substring(0,self.location.href.indexOf('.nsf') +4) + "/<framesetname>?logout&redirectTo=http://"+window.document.forms[0].Server_Name.value+"/"+window.document.forms[0].DBNameTX.value+"/";

This is a response that I posted in IBM developers forum.
http://www-10.lotus.com/ldd/nd6forum.nsf/55c38d716d632d9b8525689b005ba1c0/7ba21b9304eaa6d6852570e500215ebf?OpenDocument

Gradient effect in Lotus Notes Client and Web applications

Creating Gradient effect in Lotus Notes client is very easy. You just have to go to create a table in the form/page. Then in the Table Properties > in the Table/Cell Background tab you select Cell color. Then you select the type of style and choose the colors for the gradient. And your table cells are ready with the gradient effect.

However, this gradient effect is not visible in web. Thus, you have to find some other way to color the cells with gradient effect.

I have found one way which I have used in my earlier web-based projects. I got that from the Microsoft website. Now, of course they don't use that feature any more, I guess. However, they have left a beautiful one-liner for us.

Here's the code:

Here the startColorStr and endColorStr describe themselves what they do. You have to just choose your color code in hex decimal code.

You can check the hex codes in any tool used for photograph editing. Or you can get the code from some of the websites which generate hex code for the color you choose. One such website is: http://www.2createawebsite.com/build/hex-colors.html

Now, about the gradientType; this value can be set to "0" or "1".
1 would give you a horizontal gradient i.e. the start color would be in the left and the end color would be in the right .
0 would give you a vertical gradient i.e. the start color would be at the top and end color would be at the bottom.

You can implement this code as HTML code in your form. Or, if you have drawn a table and you want apply the gradient effect then you can use this in the table properties. All you have to do is go to the Table Properties > Table Programming tab and in the Cell HTML Tags > Style field add the following code:
filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FFFFFF', endColorStr='#98B2E6', gradientType='0')

Thus, when you preview your application in web the cells would show the gradient effect.

If there are any other way of using gradient effect in forms, then please do let me know.