2013-03-27 1 views
0

로터스 노트보기를 내 보내어 Excel로 내보내기해야합니다. 문제는, 필자는 "New line"을 구분 기호로 사용하여 여러 값을 표시하는보기에 두 개의 열이 있다는 것입니다. 나는 inbuilt 내보내기 기능뿐만 아니라 새로운 서식 파일 내보내기 기능을 사용하여 몇 가지 서식을 시도했다. 두 경우 모두 하나의 셀에 여러 값을 표시 할 수 없습니다. 첫 번째 값만 각 행에 표시됩니다. 나머지 값은 무시됩니다. 우리 사용자는 새로운 라인의 다중 값만을 사용하고 다른 구분 기호는 사용하지 말고 엑셀 보고서를 원합니다.여러 줄 데이터가있는 Lotus Notes보기 Excel로 내보내기

의견을 보내 주십시오. Lotus notes 6.5 및 Microsoft office 2010을 사용 중입니다.

감사합니다.

답변

4

로터스 펫에서 내보내기를 작성하십시오. 어렵지 않고 수출을 완전히 통제 할 수 있습니다. 필드가 다중 값 필드 인 경우 값을 변형으로 읽은 다음 각 항목 사이에 줄 바꿈을 사용하여 출력 파일에 값을 쓰면됩니다. LINEBREAK이 유효하지 않습니다, 나는이 CSV에 \ n을 함께 LINEBREAK 교체

%REM 
    Agent View Export 
    Created Mar 27, 2013 by Karl-Henry Martinsson 
    Description: Code to export a specified view as CSV. 
    Copyright (c) 2013 by Karl-Henry Martinsson 
    This code is distributed under the terms of 
    the GNU General Public License V3. 
    See http://www.gnu.org/licenses/gpl.txt 
%END REM 

Option Public 
Option Declare 

Class RowData 
    Public column List As String 

    Public Sub New() 
    End Sub 

    Public Sub SetColumnHeader(view As NotesView) 
     Dim viewcolumn As NotesViewColumn 
     Dim cnt As Integer 
     ForAll vc In view.Columns 
      Set viewcolumn = vc 
      column(CStr(cnt)) = viewcolumn.Title 
      cnt = cnt + 1 
     End Forall 
    End Sub 

    Public Sub SetColumnValues(values As Variant) 
     Dim cnt As Integer 
     Dim tmp As String 
     ForAll v In values 
      If IsArray(v) Then 
       ForAll c In v 
        tmp = tmp + c + Chr$(13) 
       End ForAll 
       column(CStr(cnt)) = Left$(tmp,Len(tmp)-1) 
      Else 
       column(CStr(cnt)) = v 
      End If 
      cnt = cnt + 1 
     End ForAll   
    End Sub 
End Class 

Class CSVData 
    Private row List As RowData 
    Private rowcnt As Long 

    %REM 
     Function New 
     Description: Open the view and read view data 
     into a list of RowData objects. 
    %END REM  
    Public Sub New(server As String, database As String, viewname As String) 
     Dim db As NotesDatabase 
     Dim view As NotesView 
     Dim col As NotesViewEntryCollection 
     Dim entry As NotesViewEntry 
     Dim colcnt As Integer 

     Set db = New NotesDatabase(server, database) 
     If db Is Nothing Then 
      MsgBox "Could not open " + database + " on " + server,16,"Error" 
      Exit Sub 
     End If 
     Set view = db.GetView(viewname) 
     If view Is Nothing Then 
      MsgBox "Could not access view " + viewname + ".",16,"Error" 
      Exit Sub 
     End If 
     Set col = view.AllEntries() 
     rowcnt = 0 
     Set entry = col.GetFirstEntry() 
     Set row("Header") = New RowData() 
     Call row("Header").SetColumnHeader(view) 
     Do Until entry Is Nothing 
      rowcnt = rowcnt + 1 
      Set row(CStr(rowcnt)) = New RowData() 
      Call row(CStr(rowcnt)).SetColumnValues(entry.ColumnValues) 
      Set entry = col.GetNextEntry(entry) 
     Loop 
    End Sub 

    %REM 
     Function CSVArray 
     Description: Returns a string array of CSV data by row 
    %END REM 
    Public Function CSVArray() As Variant 
     Dim rowarray() As String 
     Dim textrow As String 
     Dim cnt As Long 
     ReDim rowarray(rowcnt) As String 

     ForAll r In row 
      textrow = "" 
      ForAll h In r.column 
       textrow = textrow + |"| + Replace(h,Chr$(13),"\n") + |",| 
      End ForAll 
      rowarray(cnt) = Left$(textrow,Len(textrow)-1) 
      cnt = cnt + 1 
     End ForAll 
     CSVArray = rowarray 
    End Function 

    %REM 
     Function HTMLArray 
     Description: Returns a string array of HTML data by row 
    %END REM 
    Public Function HTMLArray() As Variant 
     Dim rowarray() As String 
     Dim textrow As String 
     Dim cnt As Long 
     ReDim rowarray(rowcnt) As String 

     ForAll r In row 
      textrow = "" 
      ForAll h In r.column 
       textrow = textrow + |<td>| + Replace(h,Chr$(13),"<br>") + |</td>| 
      End ForAll 
      rowarray(cnt) = "<tr>" + textrow + "</tr>" 
      cnt = cnt + 1 
     End ForAll 
     HTMLArray = rowarray 
    End Function 

End Class 


%REM 
    ******************************** 
    Example of how to call the class 
    ******************************** 
%END REM 
Sub Initialize 
    Dim csv As CSVData 
    Dim outfile As String 

    Set csv = New CSVData("DominoServer/YourDomain", "names.nsf", "People\By Last Name") 
    outfile = "c:\ExcelExportTest.csv" 
    Open outfile For Output As #1 
    ForAll row In csv.CSVArray() 
     Print #1, row 
    End ForAll 
    Close #1 

    outfile = "c:\ExcelExportTest.xls" 
    Open outfile For Output As #2 
    Print #2, "<table>" 
    ForAll row In csv.HTMLArray() 
     Print #2, row 
    End ForAll 
    Print #2, "</table>" 
    Close #2 
End Sub 
+0

참고 :

는 여기를 해결하는 방법 중 하나 생각이다. Excel에서 대체하거나 원하는 구분 기호로 바꾸십시오. –

+0

정말 고마워요 :) – Priya