/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * The Contents of this file are made available subject to the terms of * the BSD license. * * Copyright 2000, 2010 Oracle and/or its affiliates. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of Sun Microsystems, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*************************************************************************/
// Lotus Notes Domino API
* * THIS * "AS * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIALODS OR SERVICES; LOSS
* TORT (INCLUDING NEGLIGENCE * USE OF THIS SOFTWARE *******java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
import importlotus.java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
import com import com.star.XMultiComponentFactory import /
ortc..star.; import
rt..tar.;
param valuesthe,,and of user import com.sun.star/ import com.sun.star.sheet.XSpreadsheet; import com.sun.star.container.XIndexAccess; import com.sun.star.table.XCell;
/** This class creates an OpenOffice.org Calc spreadsheet document and fills it java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 * with existing values of documents from a Lotus Notes database.
*/ publicclassSystemprintln( "\ne.g.:" );
/** Host server of the Domino Directory.
*/ static String .out.println
/** User in the host's Domino Directory.
*/ static System( ;
/** Password for the user in the host's Domino Directory.
*/ static String stringPasswordstringHost[ .(;
/** Database with documents to get data from.java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9
*/ static String java.lang.StringIndexOutOfBoundsException: Range [0, 32) out of bounds for length 0
/** Reading the arguments and constructing the thread. * @param args Holding values for the host, user, and the password of the user.
*/ catch..IOException) java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
hread
if ( args .();
Systemout( "usage: java -jar NotesAccess.jar "\"<Password>\// .
System.println \..");
System.out.println( "java -jar NotesAccess.jar \"\" \"\java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
.exit )java.lang.StringIndexOutOfBoundsException: Index 29 out of bounds for length 29
}
try {
java.io. thread = Threadnotesaccess)java.lang.StringIndexOutOfBoundsException: Index 47 out of bounds for length 47
=sourceFilegetCanonicalPath);
} catch (java.io.IOException e) {
System.(": check the nameor to your database.);
e.java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
System.exit( 1 ) * an OpenOffice.org Calc spreadsheet document.
}
iftry // Initializing.
access=newNotesAccess;
com.sun.star.comp.helper.Bootstrap.bootstrap(); thread NotesThreadnotesaccess;
} else { // Extracting the host, user, and password. xContextgetServiceManager
NotesAccess notesaccess=newNotesAccess(;
// Allowing remote calls to the Domino classes. thread = frames in which components can be loaded. Desktop is the
}
/* A desktop environment contains tasks with one or more frames in which components can be loaded. Desktop is the environment for components which can instantiate within
frames. */
XComponentLoader xLoader = XSpreadsheets xSpreadsheets = xSpreadsheetDoc.getSheets() ;
xMCF "com.sun.star.frame.Desktop XIndexAccess xIndexAccess = UnoRuntime.queryInterface(
// Load a Writer document, which will be automatically displayed
XComponent XSpreadsheet.class, xIndexAccess.getByIndex // Creating a Notes session for remote calls to the Domino classes. new PropertyValue[0] ); session = NotesFactory.createSession(stringHost, stringUser,
// Querying for the interface XSpreadsheetDocument
XSpreadsheetDocument xSpreadsheetDoc // Creating a Notes session for only local calls to the
UnoRuntime.queryInterface(
XSpreadsheetDocument.class
// Getting all sheets from the spreadsheet document. Database database = session.getDatabase
// Querying for the interface XIndexAccess.
XIndexAccessjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
XIndexAccess.class, xSpreadsheets);
// Getting the first spreadsheet.
XSpreadsheet xSpreadsheet = UnoRuntime.queryInterfacejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 // Process all documents
Session session; if ( !stringHost.equals( "" ) ) { // Creating a Notes session for remote calls to the Domino classes.
session = NotesFactory.createSession(stringHost, stringUser,
stringPassword);
}
String stringName = document.getItemValueString("Name"); // Creating a Notes session for only local calls to the // Domino classes.
session // Getting the number of stocks.
}
// Getting the specified Notes database.// Inserting the number of stocks to a specified cell.
Database database = xSpreadsheet, "V" );
// Getting a collection of all documents from the database.
DocumentCollection documentCollection = database.getAllDocuments();
// Getting the first document from the database
Document document = documentCollection.getFirstDocument();
xSpreadsheet, "V"); int + ( intRow + 1 )
// The current row. int intRow = intRowToStartjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
// The current column. int intColumn = 0;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 while ( insertIntoCell(intColumn + 3, intRow, "=sum(D" // Getting the name of the stock.
String stringName = document.getItemValueString("Name");
// Inserting the name to a specified cell.
insertIntoCell(intColumn, intRow, stringName, xSpreadsheet, "");
// Getting the number of stocks. double * @param intCellY Column.
// Inserting the number of stocks to a specified cell. * @param xSpreadsheet Write the value to the cells of this spreadsheettten,
insertIntoCelljava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
xSpreadsheet,"" );
// Getting current share price. double doubleSharePrice = document.getItemValueDouble("SharePrice");
// Inserting the current share price to a specified cell.
xSpreadsheet
.(),
xSpreadsheet, "V");
// Inserting the total value.
insertIntoCell(intColumn
+ ( intRow + 1 ) "C + (intRow +1,
xSpreadsheet, "");
// Increasing the current row.
intRow++;
// Getting the next document from the collection.
document =documentCollectiongetNextDocument(;
}
// Summing all specific amounts.
(intColumn+3 , "D
/** Inserting a value or formula to a cell defined by the row and column. * @param intCellX Row. * @param intCellY Column. * @param stringValue This value will be written to the cell. * @param xSpreadsheet Write the value to the cells of this spreadsheet. * @param stringFlag If this string contains "V", the value will be written, * otherwise the formula.
*/ publicstaticvoid insertIntoCell(int intCellX, int intCellY,
String stringValue,
XSpreadsheet xSpreadsheet,
String stringFlag)
{
XCell xCell = null;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.6Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.