public void setReadings (List<Reading> readings) {

		XModel model = null;

		try {

			model = As.XModel (this.textDocument); 
			model.lockControllers();


			this.paragraphCursor.gotoStartOfParagraph (false);
			this.paragraphCursor.gotoEndOfParagraph (true);
			this.viewCursor.gotoRange (this.paragraphCursor, false);
			XTextCursor textCursor = this.viewCursor.getText().createTextCursorByRange (this.paragraphCursor);
			XPropertySet propertySet = As.XPropertySet (textCursor);

			XPropertyState propertyState = As.XPropertyState (textCursor);
			propertyState.setPropertyToDefault ("RubyText");
			propertyState.setPropertyToDefault ("RubyAdjust");


			int index = 0;
			TextPortionIterator textPortionIterator = new TextPortionIterator (this.paragraphCursor);
			Object textPortion = textPortionIterator.nextTextPortion();
			for (Reading reading : readings) {

				// Find start
				XTextRange readingStart = null;
				XTextRange readingEnd = null;

				boolean startFound = false;
				while (!startFound && (textPortion != null)) {
					XTextRange textRange = As.XTextRange (textPortion);
					String content = textRange.getString();
					if (reading.start < (index + content.length())) {
						textCursor.gotoRange (textRange.getStart(), false);
						textCursor.goRight ((short)(reading.start - index), false);
						readingStart = textCursor.getStart();
						startFound = true;
					} else {
						index += content.length();
						textPortion = textPortionIterator.nextTextPortion();
					}
				}


				// Find end
				boolean endFound = false;
				while (!endFound && (textPortion != null)) {
					XTextRange textRange = As.XTextRange (textPortion);
					String content = textRange.getString();
					if ((reading.start + reading.length - 1) < (index + content.length())) {
						textCursor.gotoRange (textRange.getStart(), false);
						textCursor.goRight ((short)(reading.start + reading.length - index), false);
						readingEnd = textCursor.getStart();
						endFound = true;
					} else {
						index += content.length();
						textPortion = textPortionIterator.nextTextPortion();
					}
				}


				// Set reading
				textCursor.gotoRange (readingStart, false);
				textCursor.gotoRange (readingEnd, true);
				propertySet.setPropertyValue ("RubyText", reading.text);
				propertySet.setPropertyValue ("RubyAdjust", new Short ((short)RubyAdjust.CENTER.getValue()));

			}

        } catch (Throwable t) {
        	ExceptionHelper.dealWith (t);
        } finally {
        	if (model != null) {
        		model.unlockControllers();
        	}
        }

	}