Skip to main content
Inspiring
Jan 29, 2020 2:27 PM UTC
Question

Découpage et intégration dans fichier - Cutting and integration in file

 

1ERE PART - Cutting
<CFIF Mode IS "Update">
	<CFOUTPUT>
	<cfset Auteur="Jean-Marc IRLES"> 
	<cfset Titre="Le dernier secret de Julie Finet">
	<cfset Destination="#db_dir#\SoLivres\_Ebooks\SoLivres\#Auteur#\#Titre#">
	<CFFILE 
			Action="UPLOAD" 
			Filefield="FichWord" 
			Destination="#Destination#"
			Nameconflict="Overwrite" 
			Accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document"> 
	</CFOUTPUT>
	<CFOUTPUT>File : "#Destination#/#Titre#.docx"</CFOUTPUT>


	<CFFILE 
			Action="Read" 
			File="#Destination#/#Titre#.docx" 
			Variable="Fich">

<CFOUTPUT><cfcontent type="application/vnd.openxmlformats-officedocument.wordprocessingml.document" file="#Destination#/#Titre#.docx"></CFOUTPUT> 

<cfsilent>
 	<cfscript>
        a = "Fich";
		console.log(a);
        chapterArray = REmatchNoCase("[\t\n\r]+\d{1,3}\s+-\s+[^\t\n\r]+[\t\n\r]{1}",variables.a);
        titleAndText = arrayNew(1);
        indexList = ""; start = 1; 
        for(i = 1; variables.i lte arrayLen(variables.chapterArray); i++){
			ndx = findNoCase (variables.chapterArray[i], variables.a, variables.start);
            start = variables.ndx + 1;
            indexList = listAppend(variables.indexList,variables.ndx);
            } 
        count = 0;
        for(i = 1; variables.i lte listLen(variables.indexList); i++){
            start = listGetAt(variables.indexList,variables.i);
            if(variables.i lt listLen(variables.indexList)){
                count = listGetAt(variables.indexList,variables.i+1)-variables.start;
                }
            else{
                count = len(variables.a);
                }
            titleAndText[variables.i]['title'] = trim(chapterArray[variables.i]);
            titleAndText[variables.i]['text'] = REreplace(trim(replace(mid(variables.a,variables.start,variables.count),variables.chapterArray[i],'','all')),'[\t|\r|\n]','<br />','all');
            }
    </cfscript>
</cfsilent>

 2EME PART - Integration
	<cfdump var="#variables.chapterArray#" />
	<cfoutput>#variables.indexList#</cfoutput><cfdump var="#variables.titleAndText#" /><br /><br />
	<cfoutput>
		<cfloop index="idx" from="1" to="#arrayLen(variables.titleAndText)#">
			<cfset part1=#variables.titleAndText[variables.idx]['title']#>
			<cfset num=#find("-", "#part1#")#>
			<cfset rest=#len(part1)# -(#num#+1)>
			<cfset part2=#right(#part1#, #rest#)#>
			<cfset chr=part2>
			<CFINCLUDE template="../inc_parser.cfm">
			<cfset part2=chr> 
			<div>Titre : #part2# </div>
			<cfset Text=#variables.titleAndText[variables.idx]['text']#>
			<cfset chr=text>
			<CFINCLUDE template="../inc_parser.cfm">
			<cfset text=chr>
			<div>Texte : #Text#</div><br><br>
			<div><hr noshade /></div> 
		</cfloop>
	</cfoutput>
		c'est fini !!
	</CFIF>
    </body>
</html>

 

 

Bonjour,

Le retour

 

Le problème est simple ... à poser :

Je ne sais comment passer les infos de la partie 1 (découpage) à la partie 2 (intégration) - voir indications dans le code.

Merci pour votre aide

 

Hello,
 The return

 


The problem is simple ... to ask:
I do not know how to pass the infos from part 1 (cutting) to part 2 (integration) - see indications in the code.
Thanks for your help

This topic is closed to new replies. Start a new post to keep the conversation going.

3 replies

Charlie Arehart
Community Expert
Community Expert
Feb 4, 2020 1:06 PM UTC

Are these two parts in the same program or not?

 

What is the error, or what specifically are you wanting to pass?

 

I realize someone else may read all the code and propose a solution. 

Translate
/Charlie (troubleshooter, carehart. org)
ZNBAuthor
Inspiring
Feb 4, 2020 2:00 PM UTC

Bonjour,

J'ai traité les problemes en 2 temps :

  • Découpage des chapitres
  • Intégration des chapitres

Les 2 parties fonctionnent mais je ne sais les joindre donc pas de message !

Merci par avance

 

Hello,
I treated the problems in 2 steps:
Division of chapters
Integration of chapters
The 2 parts work but I do not know how to join them so no message!
Thanks in advance

Translate
ZNBAuthor
Inspiring
Feb 4, 2020 11:50 AM UTC

HELP

Translate