• 15 апреля стартует «Курс «SQL-injection Master» ©» от команды The Codeby

    За 3 месяца вы пройдете путь от начальных навыков работы с SQL-запросами к базам данных до продвинутых техник. Научитесь находить уязвимости связанные с базами данных, и внедрять произвольный SQL-код в уязвимые приложения.

    На последнюю неделю приходится экзамен, где нужно будет показать свои навыки, взломав ряд уязвимых учебных сайтов, и добыть флаги. Успешно сдавшие экзамен получат сертификат.

    Запись на курс до 25 апреля. Получить промодоступ ...

Экспорт в Excel

  • Автор темы I123321
  • Дата начала
I

I123321

Помогите, плиззз. Есть отчет, не могу сообразить как в первые две строки выводить те данные, которые были выбраны в критериях.
Критерии отчета задаются так:
Код:
If (DialogDoc.RFrom(0)<>"") And (DialogDoc.CompanySpec(0)<>"") And (DialogDoc.CompanyName(0)<>"") Then		
TempStr=ReplaceSubString(DialogDoc.CompanyName( 0 ),Chr$(34),"") 
Query = {[DateIncom]>=} & DialogDoc.RFrom( 0 ) & { AND } & {[DateIncom]<=} & DialogDoc.RTill( 0 ) & { AND } & {[CompanySpec]=} & DialogDoc.CompanySpec(0) & { AND } & {[CompanyNameSearch]=} & TempStr & { AND } & {[Alias_DocumentType] IS PRESENT} 	
End If
If (DialogDoc.RFrom(0)<>"") And (DialogDoc.CompanySpec(0)="") And (DialogDoc.CompanyName(0)="") Then		
TempStr=ReplaceSubString(DialogDoc.CompanyName( 0 ),Chr$(34),"") 
Query = {[DateIncom]>=} & DialogDoc.RFrom( 0 ) & { AND } & {[DateIncom]<=} & DialogDoc.RTill( 0 ) & { AND } & {[Alias_DocumentType] IS PRESENT} 	
End If

Далее отчет заполняется в таком виде:
Код:
LineCounter=0


While Not (ContractDoc Is Nothing)
LineCounter=LineCounter+1
Print "Подождите... " Cstr(LineCounter) & " документ из " & Cstr(ndc.Count)



' порядковый номер
Call wsSetCurrentCell("A" & Cstr(IndexBase+LineCounter))
Call wsCurrentCell(	LineCounter)
'Название
Call wsSetCurrentCell("B" & Cstr(IndexBase+LineCounter)) 
Call wsCurrentCell(	ContractDoc.CompanyName(0))
Const IndexBase=4

Как в первые строчки добавить то, что было выбрано в критериях?
 
I

I123321

Подскажите, если я задаю
Код:
		wsCurrentCell("A" & Cstr(IndexBase+LineCounter))
Call wsCurrentCell(	"с " & DialogDoc.RFrom(0) & "  по " & DialogDoc.RTill(0))
то все выдает верно, но вот как все перенести, например, в 4-ю строку?
 

lmike

нет, пердело совершенство
Lotus Team
27.08.2008
7 941
609
BIT
214
здесь форум по ЛДН, а не глюкософтовому КОМу :)

яб воще делал через ХСЛТ
вот библа:
Код:
package org.xmlutils;
import lotus.domino.*;
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;

public class XSLT {
StringWriter swriter=null;
Source source=null, template=null;
Result result=null;
StringBuffer sresult=null;
File resultFile=null;
public XSLT(InputStream isxml, InputStream isxsl, OutputStream os){
Init(new StreamSource(isxml),
new StreamSource(isxsl),
new StreamResult(os));
}
public XSLT(String xml, InputStream isxsl, OutputStream os){
Init(new StreamSource(new StringReader(xml)),
new StreamSource(isxsl),
new StreamResult(os));
}
public XSLT(String xml, String xsl, OutputStream os){
Init(new StreamSource(new StringReader(xml)),
new StreamSource(new StringReader(xsl)),
new StreamResult(os));
}
//вывод результата в виде строки, через метод getStringResult
public XSLT(String xml, String xsl){
swriter=new StringWriter();
Init(new StreamSource(new StringReader(xml)),
new StreamSource(new StringReader(xsl)),
new StreamResult(swriter));
}
//вывод результата в файл с префиксом fName, путь файла - getAbsolutePath
public XSLT(String xml, InputStream isxsl, String fName){
try{
resultFile = File.createTempFile(fName, ".xml");
Init(new StreamSource(new StringReader(xml)),
new StreamSource(isxsl),
new StreamResult(resultFile));
}catch(Exception e){
System.err.println(e);
}
}
void Init(Source xml, Source xsl, Result out){
source=xml; template=xsl; result=out;
}
public boolean transform(){
boolean res=false;
try{
// get the factory
TransformerFactory transFact = TransformerFactory.newInstance( );

// get a transformer for this particular stylesheet
Transformer trans = transFact.newTransformer(template);

// do the transformation
trans.transform(source, result);
res=true;
}catch(Exception e){
System.err.println(e);
}
return res;
}
public String getStringResult(){
String res=null;
if (swriter!=null){
res=swriter.toString();
}
return res;
}
public String getAbsolutePath(){
if( resultFile != null){
return resultFile.getAbsolutePath();
}
return "";
}
}
вот её заюзывание
Код:
import lotus.domino.*;
import java.io.*;
import org.price.*;
import org.xmlutils.*;
public class OrderConfirm extends AgentOrder {
String templ="xls-xslt";
public void AgentMain() {
Document doc=orderobj.getCurrentOrder();
if (doc==null){
printError(orderobj.NOCURRENTORDER);
}else{
String uid=orderobj.confirmOrder(doc);
String xml=orderobj.getOrderDetails(doc);
xml="<document>"+xml+"</document>";
try{
View view=db.getView(orderobj.templViewName);
Document doctempl=view.getDocumentByKey(templ);
if (doctempl==null){
printError("шаблон" + templ + "не существует");
}else{
InputStream isxsl=orderobj.FirstAttachAsInputStream(doctempl,"Body");
String fName="order";
//String xsl=orderobj.FirstAttachAsString(doctempl,"Body");
XSLT xslt=new XSLT(xml, isxsl, fName);
//new XSLT(xml, xsl); 
if(xslt.transform()){
fName=xslt.getAbsolutePath();
//printError(xslt.getStringResult());
if (fName.length()>0){
sendConfirmation(doc, fName);
}else{
printError("обработаный файл не найден");
}
}
doctempl.recycle();
}
doc.recycle();
}catch(NotesException e){
printStackTrace(e);
}
}
}
}
вот шаблон и исходный xml Посмотреть вложение Excel.zip
 
Мы в соцсетях:

Обучение наступательной кибербезопасности в игровой форме. Начать игру!