Thread: Saving svg
View Single Post

  #5 (permalink)  
Old 03-09-2004, 02:51 AM
Seb
Guest
 
Posts: n/a
Default Saving svg

Michel, it is not working yet. When i do an alert on my clipboard content, i can see two <g> and </g>.

here is my code for the clipboard and your code to read the file.

function Clipboard()
{
shapes = Dess.childNodes;
Compteur = shapes.length;

if(top.clipboardData)
{
NewSVG ="";

for(i=0; i<Compteur; i++)
{
NewSVG +=printNode(shapes.item(i));
}

NewSVG='<g>'+NewSVG+'</g>';
top .clipboardData.setData("Text", NewSVG);
alert(NewSVG);
}
else alert("Vous devez creer des objets pour pouvoir utiliser cette fonction");
}

function Importer(reponse)
{
//reponse=prompt("Choisissez un fichier");
getURL("Dossier Perso\\"+reponse+".svg", fileLoaded);
}

function fileLoaded(data)
{
if(data.success)
{

new_node =parseXML(data.content, document);

var nouv=new_node.childNodes;
compte=nouv.length;

for(i=0; i<compte; i++)
{
child=nouv.item(i);
Dess.appendChild(child);
}
}
else
{
alert('Loading has failed');
}
}

Thanks, a plus s?bastien.
Reply With Quote