We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Thoughts on how to repeat data

I know about and used designer/smart spreadsheets although I have a requirement where the data is formatted a tad different, yet simple as seen in the attached Excel file.

Layout for attachment. Can have 1 to many sales blocks.

I thought perhaps a copy an existing range with formatting might be the ticket but didn't see this functionality.

Any thoughts?

Hi Kevin,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, you can create a range of your existing cells and simply copy the style and data to the newly created range. I have used your provided template file to create a range from your first Sales Record and simply added the style and data to the newly created range. Please see the sample code,

Sample Code:-

Workbook workbook = new Workbook();

workbook.Open("C:\\Main.xls");

Cells cells = workbook.Worksheets[0].Cells;

Range range = cells.CreateRange("A10", "G21");

Range range2 = cells.CreateRange("A54", "G65");

range2.CopyStyle(range);

range2.CopyData(range);

cells["A55"].PutValue("Sale #5");

workbook.Save(@"c:\combinestyles_test.xls");

However, in this case you may have to manipulate the newly created range data by yourself, like I have to put the value for new range sale heading by myself to make it Sale #5. Hope this code segment will help you out.

Thank You & Best Regards,

Thanks for the solution.

Many times when there are so many options in a library with limited time to find them I believe it's best to ask the expert and as usual you come through.

Kevin

nausherwan.aslam:

Hi Kevin,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for considering Aspose.

Well, you can create a range of your existing cells and simply copy the style and data to the newly created range. I have used your provided template file to create a range from your first Sales Record and simply added the style and data to the newly created range. Please see the sample code,

Sample Code:-

Workbook workbook = new Workbook();

workbook.Open("C:\\Main.xls");

Cells cells = workbook.Worksheets[0].Cells;

Range range = cells.CreateRange("A10", "G21");

Range range2 = cells.CreateRange("A54", "G65");

range2.CopyStyle(range);

range2.CopyData(range);

cells["A55"].PutValue("Sale #5");

workbook.Save(@"c:\combinestyles_test.xls");

However, in this case you may have to manipulate the newly created range data by yourself, like I have to put the value for new range sale heading by myself to make it Sale #5. Hope this code segment will help you out.

Thank You & Best Regards,