Pman.Gnumeric.js
[Pman.Core] / Pman.Gnumeric.js
index 61486cf..e56937a 100644 (file)
@@ -699,9 +699,6 @@ Roo.extend(Pman.Gnumeric, Roo.util.Observable, {
     {
         
         data = data || this.data;
-        
-        Roo.log(data);
-        
         for (var r = 0; r < this.rmax;r++) {
             if (typeof(this.grid[r]) == 'undefined') {
                 continue;
@@ -714,7 +711,7 @@ Roo.extend(Pman.Gnumeric, Roo.util.Observable, {
                         || !this.grid[r][c].value.match(/\{/)) {
                     continue;
                 }
-                Roo.log(this.grid[r][c].value);
+                
                 var x = new Roo.Template({ html: this.grid[r][c].value });
                 try {
                     var res = x.applyTemplate(data);
@@ -1142,7 +1139,7 @@ Roo.extend(Pman.Gnumeric, Roo.util.Observable, {
      */
     
     
-    writeImage : function (row, col, data, width, height) 
+    writeImage : function (row, col, data, width, height, type
     {
         
         if (!data) {
@@ -1190,7 +1187,6 @@ Roo.extend(Pman.Gnumeric, Roo.util.Observable, {
                 break;
             }
         }
-       
         
         soi.setAttribute('ObjectBound',
             //gnumeric_colRowToName(row,col) + ':' + gnumeric_colRowToName(row+1,col+1));
@@ -1213,14 +1209,26 @@ Roo.extend(Pman.Gnumeric, Roo.util.Observable, {
         soi.setAttribute('crop-left','0.000000');
         soi.setAttribute('crop-right','0.000000');
                 // <Content image-type="jpeg" size-bytes="3900">......  < / Content>
+                
+        var name = 'Image' + Math.random().toString(36).substring(2);
         var content = this.doc.createElement('Content');
-        content.setAttribute('image-type','jpeg');
-        //alert(imgsrc);
-        
-        content.setAttribute('size-bytes',data.length);
-        content.textContent = data;
+        content.setAttribute('image-type', type ? type : 'jpeg');
+        content.setAttribute('name', name);
         soi.appendChild(content);
         objs.appendChild(soi);
+        
+        var godoc = this.sheet.getElementsByTagNameNS('*','GODoc')[0];
+        
+        var goimage = this.doc.createElement('GOImage');
+        goimage.setAttribute('image-type', type ? type : 'jpeg');
+        goimage.setAttribute('name', name);
+        goimage.setAttribute('type', 'GOPixbuf');
+        goimage.setAttribute('width', width);
+        goimage.setAttribute('height', height);
+        goimage.textContent = data;
+        
+        godoc.appendChild(goimage);
+        
         return true;
                 //< /gnm:SheetObjectImage>
                 // < /gnm:Objects>