Trace files generated word list, position the cursor to mark where the page

2010-10-18  来源:本站原创  分类:CPP  人气:253 

The company had to develop several projects, all related to the document on-line editing, a good implementation of this feature is currently found on the Internet can be a lot of online editorial office and middleware controls the files, regardless of the product free of charge or for a fee The company has a lot of trial and later found soaoffice pretty good, unfortunately, this product is money, but save the company's own development costs, it has been in use. The paper trail shows the generation of a list of implementation and position the cursor to mark the page where the function is achieved by soaoffice, where the first statement before they go to see the final say to use soaoffice, you then let's use tile shoot me, said I deceive you waste your time, so to uneconomical.

Traces of a list of ideas generated: generated when the file is loaded. When the file is loaded, using the VBA interface to provide soaoffice through all word marks, for the time and traces of traces of user-generated list (you can get more information if you wish, of course, word had to support long), to each a trace of information used to wrap the following hyperlink, which is generated for each trace is a hyperlink, 'goToRevision function of the parameters i used to pass the serial number of traces. Trace information when the user clicks on the Executive position the cursor to mark where goToRevision page.

<a href='#'> trace information </ a>
Traces of the list generated js method:
function loading () {
var docObj = document.getElementById ("SOAOfficeCtrl"). Document;
var rvsCount = docObj.Revisions.Count;
var rvsList = "";

rCount = rvsCount;

for (var i = 1; i <= rvsCount; i + +)
{
var rvsObj = docObj.Revisions.Item (i);
var dt = new Date (rvsObj.Date);

rvsList = rvsList + "<a href='#'>" + rvsObj.Author +":"+ dt.toLocaleString () + "</ a> <br>";
}

document.getElementById ("rvl"). innerHTML = rvsList;
}

Needless to say traces of the idea of positioning the interface is to call the office, position the cursor to mark where the page is to goToRevision, the key is the two codes:
docObj = document.getElementById ("SOAOfficeCtrl"). Document; / / get office Interface
docObj.Revisions.Item (index). Range.Select (); / / position the cursor to mark where the page shows the code:
function goToRevision (index)
{
refreshList ();
var docObj = document.getElementById ("SOAOfficeCtrl"). Document;
try {
docObj.Revisions.Item (index). Range.Select ();
}
catch (e) {
loadList ();
}

}
In the demo code there are two useful functions refreshList and loadList What is it? Let me talk refreshList role. If you open the file mode is cleared draft mode (soaoffice in draft mode called core, is to accept and reject changes the mode function) users who accept or reject a revised Yihou trace file will be one less, if the user is not the file The last trace, then trace the serial number of the traces after the values are decreased by 1, for example, a total of five marks, the user accepts the first three marks, then the first three traces does not exist, the first traces of the serial number 4 becomes 3, became the first three marks, the first traces of the number 5 into 4, and so on ... ..., so the need to generate about the list.
loadList main function is to update the list before the update to load a gif animation, reminder list of users in the update, or click on the user traces a list of signs and feel a little strange.
loadList code:
document.getElementById ("rvl"). innerHTML = "<br> <img src='load.gif'> <br> <br>"; / / show about "loading effect" of the gif image that prompts the user to update trace list.
setTimeout (loading, 500); / / update the real signs of the beginning of the list.

Download the complete demo: http://ishare.iask.sina.com.cn/f/10865554.html

Simple.jsp Detailed code:
******************
<% @ Page contentType = "text / html; charset = gb2312" language = "java" import = "java.sql .*, java.awt .*, java.util .*" errorPage = ""%>
<% Request.setCharacterEncoding ("gb2312 ");%>
<% @ Page pageEncoding = "GB2312"%>
<%
SOAOfficeX.SOAOfficeCtrl SOACtrl = new SOAOfficeX.SOAOfficeCtrl (pageContext);
/ / Set SOAOFFICE middleware service page
SOACtrl.ServerURL = "/ soaservlet / soaserv.do";

SOACtrl.MenubarStyle = 5;

SOACtrl.SaveDocURL = "SaveDoc.jsp";
SOACtrl.webOpen ("doc / test.doc", 1, "somebody", "Word.Document");
%>

<HTML>
<HEAD>
<TITLE> Traces of processing - soaoffice </ TITLE>
<META Http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE Type=text/css>
body {

text-align: center;
min-width: 800px;
color: # FFFFFF;
margin: 0px;
padding: 0px;
}

# Header {
WIDTH: 1000px; HEIGHT: 50px; color: red;
}
# Wrapper {
MARGIN-TOP: 10px; WIDTH: 1000px
}
# Navigation {
MIN-HEIGHT: 700px; FLOAT: left; WIDTH: 200px; HEIGHT: 700px; border: 1px solid red; color: # 333;

}
# Content {
MARGIN-TOP: 10px; MIN-HEIGHT: 700px; MARGIN-LEFT: 210px; WIDTH: 740px; HEIGHT: 700px; BACKGROUND-COLOR: # 333333
}
# Footer {
MARGIN-TOP: 10px; WIDTH: 1000px; HEIGHT: 100px;
}
. HTitle {
font-size: 14px; line-height: 25px; BACKGROUND-COLOR: # FFFF8F; border-bottom: 1px solid red;
}
. Henji {
font-size: 12px; border-bottom: 1px solid green; line-height: 25px;
}
</ STYLE>

<META Content="MSHTML 6.00.3790.4772" name=GENERATOR>

</ HEAD>
<body>
<SCRIPT Language="JavaScript">
var rCount = 0; / / Save the file in the number of traces
function refreshList ()
{
var docObj = document.getElementById ("SOAOfficeCtrl"). Document;
var rvsCount = docObj.Revisions.Count;
if (rvsCount! = rCount) {
loadList ();
}
}
function goToRevision (index)
{
refreshList ();
var docObj = document.getElementById ("SOAOfficeCtrl"). Document;
try {
docObj.Revisions.Item (index). Range.Select ();
}
catch (e) {
loadList ();
}

}
function loadList ()
{
document.getElementById ("rvl"). innerHTML = "<br> <img src='load.gif'> <br> <br>";
setTimeout (loading, 500);

}
function loading () {
var docObj = document.getElementById ("SOAOfficeCtrl"). Document;
var rvsCount = docObj.Revisions.Count;
var rvsList = "";

rCount = rvsCount;

for (var i = 1; i <= rvsCount; i + +)
{
var rvsObj = docObj.Revisions.Item (i);
var dt = new Date (rvsObj.Date);

rvsList = rvsList + "<a href='#'>" + rvsObj.Author +":"+ dt.toLocaleString () + "</ a> <br>";
}

document.getElementById ("rvl"). innerHTML = rvsList;
}

</ SCRIPT>

<DIV click on the "list trace" in the traces, position the cursor to mark where page. </ DIV>
<DIV
<DIV
<div> trace list:
<a href="#"> Refresh </ a>
</ Div>
<div>
</ Div>
</ DIV>
<DIV
<!--************** SOAOFFICE start ************************--> client code
<SCRIPT Language="JavaScript" event="OnInit()" for="SOAOfficeCtrl">
/ / Control to open the document before the trigger is used to initialize the interface style
</ SCRIPT>
<SCRIPT Language="JavaScript" event="OnDocumentOpened(str, obj)" for="SOAOfficeCtrl">
/ / Control to open the document immediately after the trigger, add custom menus, custom toolbars, prohibiting printing, prohibiting Save, save, etc. prohibited
loadList ();
</ SCRIPT>
<SCRIPT Language="JavaScript" event="OnDocumentClosed()" for="SOAOfficeCtrl">

</ SCRIPT>
<SCRIPT Language="JavaScript" event="OnUserMenuClick(index, caption)" for="SOAOfficeCtrl">
/ / Add your custom menu items incident response
</ SCRIPT>
<SCRIPT Language="JavaScript" event="OnCustomToolBarClick(index, caption)" for="SOAOfficeCtrl">
/ / Add your custom toolbar buttons Incident Response
</ SCRIPT>
<! - OBJECT tag, the client control references ->
<OBJECT codeBase = "SOAOffice.ocx # version = 8,1,0,0" height = "100%" width = "100%" classid = "clsid: 83171BA4-BDCA-42a8-BE44-745ABF36EB7E" data = "" VIEWASTEXT>
<div align=center> SOAOFFICE not yet installed the machine controls the client, install the top of the browser prompt or in the yellow box SOAOFFICE prompted the client control. </ Div>
</ OBJECT>
<!--************** SOAOFFICE end ************************--> client code
</ DIV>
</ DIV>
<DIV
</ Body>
</ HTML>

相关文章
  • Trace files generated word list, position the cursor to mark where the page 2010-10-18

    The company had to develop several projects, all related to the document on-line editing, a good implementation of this feature is currently found on the Internet can be a lot of online editorial office and middleware controls the files, regardless o

  • IBM AIX Core files generated methods (transfer) 2010-11-08

    IBM AIX Core files generated in the method environment: (product, platform, model, software version, etc.) Platform: RS Software Version: AIX4.3 or later description of the problem: If you need an application process to produce a complete core file f

  • JSP page, Servlet Java class files generated during the coding problem involved 2010-10-07

    When requesting a JSP page, the general need through the following stages: 1, the application server based on JSP page to generate a Java file 2, the application server will call java.exe Java file is compiled into a Servlet class file corresponding

  • Jsp page generated Word document 2010-10-29

    1. First, build a Word document template, and the related pre-populated with the contents. 2. The Word document as htm format, if saved as Web Page, Filtered (html), then the relevant format, such as header and footer information will be lost. 3. The

  • [Change] Examples of the use of iText generated word document for reference 2010-03-29

    package com.sample; import java.awt.Color; import java.io.FileOutputStream; import java.io.IOException; import com.lowagie.text.Cell; import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Element; import

  • PHP generated word and excel documents 2010-09-02

    <html xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40"> word You want to display content, since the word Supports HTML format , This part uses the intermediate html document can . </html&

  • [Reserved] will. Class files generated executable jar 2010-10-18

    Operator into the dos window cd into the package to be labeled jar class file directories all folders jar cvf [generated jar name. jar] [List class file] / / If there are multiple, separated by space separated Such as: One. Operate a single or a few

  • Using Task Scheduler comes with windows automatic backup function of the files generated by the project 2010-11-29

    First, write yourself a batch command, which is a bat file which will be generated by the project's files to a folder. Step one: first create a new txt file, and then write to the txt file the following content. @echo off xcopy h:\txt\* h:\backup\tem

  • Hibernate Mapping files generated by myeclipse No entries available when a solution 2011-04-29

    Original link: http://gundumw100.iteye.com/blog/436692 In hibernate, each corresponding data table is an entity class, each class has a corresponding entity profile and you hbm.xml match, myeclipse There is a MyEclipse Database Explorer view, it prov

  • Html static files generated using the FreeMarker 2010-03-29

    import java.io.*; import java.util.HashMap; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import freemarker.template.*; /* * Created on 2005-4-7 * */ /** * Test FreeMarker. * * @author scud

  • php back up the database (generated word, excel, json, xml, sql) 2010-04-25

    Code: <?php class Db { var $conn; function Db($host="localhost",$user="root",$pass="root",$db="test") { if(!$this->conn=mysql_connect($host,$user,$pass)) die("can't connect to mysql sever"); mysql_se

  • tomcat log files generated 2010-08-30

    By copying the following log4j.properties in the content, you can generate log files to the specified directory: # Define DEBUG priority, R for the purpose of the log output # Log4j.rootLogger = debug, P # Set the log output type, for the file type #

  • perform background tasks ajax download csv files generated 2011-04-13

    Click of a button, generate a csv file, the generation process is very time-consuming csvs to put the background, generated after the expiry, but also to send the file to the client, this time using ajax request, to determine whether the file success

  • Words under a single fat32 and ntfs folder can limit the number of files generated 2011-03-11

    Yesterday, a problem encountered in the project, which is when a static site problem, the system reported a File not found, the upper error Is , file or directory can't not create , I wonder, has been repeatedly tested twice and the problem is not su

  • Reproduced, printed or eps files generated ps 2011-09-27

    Today to see Preparation of Papers for IEEE TRANSACTIONS and JOURNALS (May 2007) when, which mentioned how to use Word, etc. Save the image ps format reads as follows: The effect that, first download a Adobe's ps printer driver ( Download , win xp an

  • php cache files generated 2010-04-22

    Code: <?php /* Instance : include("cache.php"); $cache = new cache(30); $cache->cacheCheck(); echo date("Y-m-d H:i:s"); $cache->caching(); */ class cache { // The cache directory var $cacheRoot = "./cache/"; // Cache

  • Use awk packet structure according to the definition of the header files generated database scripts 2010-05-11

    Note two points: 1, in the awk script, if you need the contents of two string variables connected, then direct them together on the line; 2, serialization to the file operations, such as file name ****.**, dot system as a special symbol, will lead to

  • The temporary files generated python 2010-12-14

    #!/usr/bin/evn python import os; import sys; import uuid; def WriteStrToFile(strFile, strVal): bRet = False; file = None; try: file = open(strFile, "wb"); file.write(strVal); bRet = True; finally: if file: file.close(); return bRet; if "__m

  • Itext generated Word document, in accordance with html, contains a picture 2010-12-27

    package cn.com.wzf; import java.io.FileOutputStream; import java.io.OutputStream; import java.io.StringReader; import java.util.List; import com.lowagie.text.Document; import com.lowagie.text.PageSize; import com.lowagie.text.Paragraph; import com.lo

  • ADUMP a large number of trace files directory is filled 2011-05-09

    Analysis Oracle 11g, create a database if you select the default security settings, audit_trail default setting for the DB, at this time that the audit is enabled by default The default audit log database will record session information, database shu