Modifying different file types inside .docx file

Hello,
I am working on a project (in java) using aspose.words library (and i have liscence).
i am trying to create a function that gets as a parameter a document (more specifically a .docx file) run all over the ole objects that it contains and modify several ole objects like images or ooxml files.
I am using this function:

NodeCollection<Shape> shapes = document.getChildNodes(NodeType.SHAPE, true);
for (Shape shape : shapes)
{
    if (shape.getOleFormat() != null)
    {
        String progId = shape.getOleFormat().getProgId();
        if (progId.equals("Word.Document.12"))
        {
            // take the shape convert it into a .docx file.
            // run a function that adds data to the file.
            // convert the file back to a shape.
            // swap between the old shape and the new shape.
        }
    }
}

the main problem is that i couldn’t find any helpful code that will help me implement my wish.
this is the code that i currently have:

DocumentBuilder builder = new DocumentBuilder(document);
Path path = Paths.get("/home/gal/Desktop/second.docx");
byte[] data = Files.readAllBytes(path);
InputStream stream = new ByteArrayInputStream(data);
InputStream representingImage = new FileInputStream("/home/gal/Desktop/word_icon.ico");
Shape shape = builder.insertOleObject("/home/gal/Desktop/second.docx", "Package",
    false,false,  representingImage);
OlePackage setOlePackage = shape.getOleFormat().getOlePackage();
setOlePackage.setFileName("file1.docx");
setOlePackage.setDisplayName("word.docx");

the problem with this code that it inserts the internal file as an clickable icon an then when i open the external file i can click on the icon insisde the external file and it would open the internal file but i dont want to have an icon i want it to look like createing a docx file inside docx file using Microsoft Office application.
in addition to this problem there is another problem that the internal file is being saved as a binary file and not as a docx file (probably because i am using oleobjects).
therefore i have tried to use DocumentBuilder.insertDocument and Document.appendDocument but it only copies the data from the internal file and pastes it in the external file (yet not what i am trying to reach.
my main idea is to this this not onlly with docx inside docx but also with images inside docx and other file types.
i would like to have some help with the code.
thanks.

@Lidor In your case it is required to provide a representation image of the inserted OLE object. For formats supported by Aspose.Words you can generate such image by saving the first page of the document as an image. For example see the following code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Open the document and generate representation image.
String srcPath = "C:\\Temp\\in.docx";
Document src = new Document(srcPath);
ByteArrayOutputStream imageOutStream = new ByteArrayOutputStream();
src.save(imageOutStream, new ImageSaveOptions(SaveFormat.EMF));

// Insert OLE object.
builder.insertOleObject(srcPath, false, false, new ByteArrayInputStream(imageOutStream.toByteArray()));

doc.save("C:\\Temp\\out.docx");

Could you please elaborate the problem in more details. It is expected that the embedded document is stored as OLE object in binary representation. If possible, please created the expected output in MS Word and attach it here for our reference.

i have to admit this advice was very helpful and it actually does what i want, therefore big big thank you.
But there is another problem.
when i unzip the docx file that i have created with this code then the “internal docx file” saved in the dir word/embeddings as oleobject1.bin.
can you help me to implement the same idea but make the internal file to be saved as .docx file?

@Lidor I am afraid, there is no way to store embedded OLE object in MS Word document in it’s original format.