Provide any property to identify whether that individual page contains color or not. Same as you provide in aspose.Word ( doc.GetPageInfo(0).Colored)
Could you please specify which Aspose (.NET) APIs you are using or which file formats you are working with. Moreover, kindly share some sample files/documents having different pages to demonstrate your requirements. We will check and assist you accordingly.
Hello @amjad.sahi
Aspose.Cells, Aspose.Diagram, Aspose.Imaging, Aspose.Note, Aspose.PDF, Aspose.PUB, Aspose.Slides This all API and Aspose.Word API version is (23.5.0) we are using.
Thanks.
As requested earlier, kindly zip and share/attach some sample files/documents having different colored pages to demonstrate your requirements for the APIs. We will check and assist you soon.
Hello @amjad.sahi
Please Find Below Attachment Of sample files/documents having different colored pages.
InputSample.zip (5.9 MB)
Thanks
Thanks for the sample files.
1). Regarding Aspose.Cells for Excel spreadsheet (XLSX file), please note, a worksheet is composed of cells, so you need to evaluate individual cells of the sheet to get their style/formatting to check background or shading color. You may get the Style of the cell and then evaluate its ForegroundColor to evaluate the color. Please use the Style.ForegroundColor property. It will return cell shading color:
e.g.
Sample code:
var workbook = new Workbook("Book1.xlsx");
var sheet = workbook.Worksheets[0];
//Get the A1 cell
Cell cell = sheet.Cells.GetCell(0, 0);
Style style = cell.GetStyle();
Console.WriteLine(style.ForegroundColor.ToArgb().ToString());
For your information, if the pattern (Style.Pattern) is “Solid” or “None”, the foreground color (set/get) would be the shading color. For all other pattern types, you will use background color of the style.
See the document for your reference:
https://docs.aspose.com/display/cellsnet/Cells+Formatting#CellsFormatting-ColorsandBackgroundPatterns
2). Regarding Aspose.Note for OneNote documents, you may load OneNote document via Document class. Then, access a RichText node whose font and colors are to be retrieved. Now access TextStyle and get text’s font color. See the document for your reference.
https://docs.aspose.com/note/net/working-with-text-styles/
Regarding other file formats and other Aspose for .NET APIs, our respective teams will evaluate and assist you accordingly.
Hello @amjad.sahi
We want to identify property while generating multiple pages tiff of workbook.
Thanks
There is no single property to check color and you have to traverse worksheet cells for it.
For Aspose.PDF, you can determine the page color using below code example in the documentation:
Hello @asad.ali
Not Getting Proper Value in pdfDocument.Pages[pageCount].ColorType Property (Need to return Black & white or grayscale in second page)
Please find below Attachment
ColorText_word.pdf (218.3 KB)
We tested the case using Aspose.PDF for .NET 23.6 and below is the console output that we received in our environment. Would you please make sure to use the latest version of the API and let us know if issue still persists:
Document doc = new Document(dataDir + "ColorText_word.pdf");
foreach (Page page in doc.Pages)
{
Console.WriteLine($"Page Number : {page.Number} || Color Type : {page.ColorType}");
}
Output
Page Number : 1 || Color Type : Rgb
Page Number : 2 || Color Type : BlackAndWhite
Page Number : 3 || Color Type : BlackAndWhite
Page Number : 4 || Color Type : BlackAndWhite
Hello @asad.ali
Not Working Your Solution, Always Same ColorType property in All page.(In Version 23.6)
Thanks
Are you using a valid license while testing? Also, can you please share a sample console application for our reference so that we can try to replicate the issue in our environment and address it accordingly.
Hello @asad.ali
Please Find below Code sample and output of PDF
using AsposePdf = global::Aspose.Pdf;
AsposePdf.Document _document = new AsposePdf.Document(datadir + “ColorText_word.pdf”);
foreach (AsposePdf.Page page in _document.Pages)
{
Console.WriteLine($"Page Number : {page.Number} || Color Type : {page.ColorType}");
}
OUTPUT:
Page Number : 1 || Color Type : Rgb
Page Number : 2 || Color Type : Rgb
Page Number : 3 || Color Type : Rgb
Page Number : 4 || Color Type : Rgb
Input PDF :ColorText_word.pdf (218.3 KB)
Its nice to know that your issue is sorted out. Please feel free to create a new topic in case you need further assistance.
Hello @asad.ali
Still below extension not support except(Aspose.word,Aspsoe.pdf)
Aspose.Cells , Aspose.Diagram , Aspose.Imaging , Aspose.Note , Aspose.PUB , Aspose.Slides
Thanks
To evaluate colors regarding Aspose.Cells and Aspose.Note, we already replied and provided the details. See the reply for your reference.
Regarding Aspose.Diagram, Aspose.Imaging, Aspose.PUB and Aspose.Slides, our concerned teams will assist you soon.
@hemalp,
I apologize for the belated reply. I looked at your sample presentation above. Could you please describe the issue you are experiencing in more detail?
Hello @amjad.sahi @asad.ali
reply According to your reply for Aspose.Cell it’s not possible to access all cells and check their color, we want to identify the property of particular pages while imageGeneration using Aspose.Cells , Aspose.Diagram , Aspose.Imaging , Aspose.Note , Aspose.PUB , Aspose.Slides etc. Please give me a proper solution on how to identify the property of All pages above mentioned all extension type reply And check the above we already describe the issue in detail.
Thanks