Problem with .dot file custom properties

Hi everyone

I have a code in C# that reads a .dot file and deletes some custom properties from this file and saves it as .dot. I am using Aspose library .

I have an other tool that reads and works with this saved file and this tool just can work with .dot file in whitch their text typed cusom properties are Ansi or UTF8

I tried to convert properties to ansi or UTF8 manually in my C# code , but unfortunately the created file is not acceptable in external tool.

I dont know if there is any built in function in Aspose to handle the custom propeties of type text, if they should be converted to ansi or UTF8?
Has anyone any idea?

Regards

Hi, what exactly Aspose library do you use? It seem that your problem is irrelevant to Aspose.TeX puduct family.

Hi I am using the last version with license . I have some word template .dot files that are created with Microsoft.Office.Interop.Word . I use Aspose to open these documents and delete some custom properties sfrom them and save them again as .dot

Also it is important that there are some charachters like ä, ü , ö in my custom properties Values.

I have another app that uses these .dot files(that are manipulated by Aspose) . Now here is a scenario:

1- When I use Microsoft.Office.Interop.Word to open original .dot files and remove some custom properties , my app can work with them.

2- When I use Aspose to open original .dot files and remove some custom properties , my app can not work with created files.

I tought that maybe Aspose has some problem with manipulating .dot files. Actually I am not Word professional , that is why I wrote in Forum.

Best Regards

Again, it’s not clear what exactly Aspose library you use. Can you please share a code snippet that employs the Aspose library you’re talking about? There’s no just Aspose library. There are a number of product families developed and maintained by Aspose.

Hi. Aspose.Word

Here you can find code snippet.

using Aspose.Words;
using Document = Aspose.Words.Document;

class Program
{
    static void Main(string[] args)
    {

        string sourceFilePath = @"D:\MyVorlagen\G1101006.dot";
        string targetFilePath = @"D:\my\G1101006.dot"; 


        // Now proceed with Aspose.Words processing
        var license = new License();
        license.SetLicense(@"Resources\Aspose.Words2.lic");

        try
        {
            Document doc = new Document(sourceFilePath);

            var list = new List<string>()
            {
                "e_gcosy_iaz",
                "e_gcosy_iaz_akten",
                "e_prozessname",
                "e_unterprozess",
                "e_formulartyp"
            };
            dynamic newPrp = DeleteCustomProperties(doc, list);

            doc.CustomDocumentProperties.Clear();
            foreach (dynamic prop in newPrp)
            {
                doc.CustomDocumentProperties.Add(prop.Name, prop.Value);
            }

            doc.Save(targetFilePath, SaveFormat.Dot);
            Console.WriteLine("Document processed and saved successfully.");
        }
        catch (Exception ex)
        {
            Console.WriteLine($"Aspose Error: {ex.Message}");
        }




        static object DeleteCustomProperties(Document doc, List<string> propertiesToDelete)
        {
            var propertiesFound = new List<object>();

            foreach (var property in doc.CustomDocumentProperties)
            {
                if (!propertiesToDelete.Contains(property.Name))
                {
                    propertiesFound.Add(property);
                }
            }

            return propertiesFound;

        }
    }
}

Regards

Hi,
since you are using Aspose.Words, you should have asked your question here Aspose.Words Product Family - Free Support Forum - aspose.com. The current forum is for Aspose.TeX only.