Can't save pages from doc file to docx file via stream

Hi,

I am creating one function that will convert a doc file to a docx file, and in the process split the file into subsections. It will take in a byte representation of a file (.doc), and return a list of byte array representations of .docx files each representing a chunk of the original file. I used this Aspose documentation for reference: Split a Document in Python|Aspose.Words for Python via .NET. However, when I run it, I get this error RuntimeError: Proxy error(NotSupportedException): Specified method is not supported. If I try to use save_format as aw.SaveFormat.DOCX instead of aw.SaveFormat.DOC, it will work. Why is that?

def _word_conv(self, input_stream, save_format=None):
        """Convert a word document from one type to another using aspose words.

        Args:
            input_stream: Stream of input document.
            save_options (optional): Save options for conversion. Defaults to None.
        """
        print("%s - %s - Sending %s to converter/splitter." % (datetime.now(), self.tardis_id, self.src_file_type))
        
        # Open input stream as aw doc
        doc = aw.Document(input_stream)
        
        # Check if page count is too large
        output_bytes_items = []
        if doc.page_count > MAX_DOC_PAGES:
            print("%s - %s - Splitting %s into %s chunks." % (datetime.now(), self.tardis_id, self.src_file_type, math.ceil(doc.page_count / CHUNK_SIZE)))
            
            # Traverse pages and take chunks 
            for chunk_start in range(0, doc.page_count, CHUNK_SIZE):
                chunk_end = min(chunk_start + CHUNK_SIZE, doc.page_count)
                extracted_pages = doc.extract_pages(chunk_start, chunk_end - chunk_start)
                                        
                # Save and append to output
                with io.BytesIO() as out_stream:
                    extracted_pages.save(out_stream, save_format)
                    output_bytes_items.append(out_stream.getvalue())
        
        # If doc is small enough export as is 
        else:
            with io.BytesIO() as out_stream:
                doc.save(out_stream, save_format)
                output_bytes_items.append(out_stream.getvalue())

        return output_bytes_items

@acn This issue (WORDSNET-26550) is already resolved in the current codebase. The fix will be included into the next 24.4 version of Aspose.Words. it will be published in a couple of weeks. We will be sure to let you know once it is available.

Is there any workaround in the meantime?

@acn I am afraid there is no workaround for this issue. Please accept our apologies for your inconvenience.

A post was split to a new topic: Cannot save xls to stream

The issues you have found earlier (filed as WORDSNET-26550) have been fixed in this Aspose.Words for .NET 24.4 update also available on NuGet.