Free Support Forum - aspose.com

Quoteprefix settings

Hi,
my aspose version is 17.6.6, do you know how to set the quoteprefix?

@985664960,

In your version, i.e., Aspose.Cells for .NET v17.6.x, if you have Style.QuotePrefix attriibute (you may check the APIs) then you can set otherwise you have to upgrade to newer versions of the APIs.

Thanks, I have found a way to set the QuotePrefix. I got another question. Do we have a way to set the margin top/bottom of a picture in the footer? I have tried the code below, it seems not working.
Picture pic = worksheet.PageSetup.SetFooterPicture(item.section, item.Image);
pic.Bottom = 180;

@985664960,
We have tried to set the bottom margin of a footer having picture in it. It moves the picture as per the set values and it is moved accordingly. Please give a try to the following sample code and share the feedback. If it does not fulfill your requirement, you may provide us a sample Excel file with required footer settings, images of MS Excel where you set those values and a runnable complete console application which can be used to reproduce this scenario. We will analyze the information here and provide assistance accordingly.

Workbook workbook1 = new Workbook("sample.xlsx");
workbook1.Worksheets[0].PageSetup.FooterMarginInch = 1;
workbook1.Save("output.xlsx");

Hi, sorry I am not mean the entire footer, I one picture in left section of the footer and one text in the middle section of the footer. Now I want keep the picture and text in same horizon. So I want to know how to set the margin top/bottom of the picture.

@985664960,
I have tried to achieve the same using MS Excel but could not prepare a sample. Please send us an expected output template Excel file created with MS Excel along with the footer image for our reference

Thank you for your reply so quickly. The attachment is the excel and screenshot. Please check.Desktop.zip (129.2 KB)

@985664960,
You may please give a try to the following sample code and share the feedback.

// Creating a Workbook object
Workbook workbook = new Workbook();

// Creating a string variable to store the url of the logo/picture
string logo_url = "Footer.png";

// Declaring a FileStream object
FileStream inFile;

// Declaring a byte array
byte[] binaryData;

// Creating the instance of the FileStream object to open the logo/picture in the stream
inFile = new System.IO.FileStream(logo_url, System.IO.FileMode.Open, System.IO.FileAccess.Read);

// Instantiating the byte array of FileStream object's size
binaryData = new Byte[inFile.Length];

// Reads a block of bytes from the stream and writes data in a given buffer of byte array.
long bytesRead = inFile.Read(binaryData, 0, (int)inFile.Length);

// Creating a PageSetup object to get the page settings of the first worksheet of the workbook
PageSetup pageSetup = workbook.Worksheets[0].PageSetup;

// Setting the logo/picture in the left section of the page footer
pageSetup.SetFooterPicture(0, binaryData);

// Setting the script for the logo/picture
pageSetup.SetFooter(0, "&G");

// Setting the text in the central section of the page footer with the script
pageSetup.SetFooter(1, "Note: The above amounts are unaudited and are not to be used for income tax purposes.");

// Saving the workbook
workbook.Save("output.xlsx");

//Closing the FileStream object
inFile.Close();

Hi, My code is almost the same with yours, and I can create the excel with both picture and text in the footer, but I think you do not really understand my question. My question is the picture and text in the footer is not in the same line. When I try to set the bottom of the picture to make the the picture a little lower, it’s not working. Do you have a way to make the picture and the text in the same position?

@985664960,
Please note that the bottom property which you are referring with respect to the picture is not applicable for header and footer. It is effective for pictures in the worksheet cells. No such property is found which can move up/down the image only in the footer. However if you can perform the same task in MS Excel, please share the steps with us. We will try to provide you assistance to achieve the same functionality in Aspose.Cells.

Hi, The attachment is the step for you to perform the same task in MS Excel. I set the bottom be 0.6 inch. Then it’s working in the MS Excel, but when I do the settings in aspose it’s not working.Desktop_new.zip (149.3 KB)

@985664960,
We are working on this issue and will share our feedback soon.

@985664960,
Thank you for providing the detailed information. We have observed the issue but we need to look into it more. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.
This issue has been logged as

CELLSNET-47260 – Crop picture in Footer

Thank you, I will wait.

@985664960,

Please use the following code, it will work for your needs:
e.g
Sample code:

......
Picture pic = pageSetup.GetPicture(false, 0);//get picture of footer.
pic.FormatPicture.BottomCrop = 0.6/ pic.HeightInch;//scale of the height.

Thank you so much. It work now.

@985664960,

Good to know that the suggested code segment works for your needs. Feel free to write us back if you have further queries or comments, we will be happy to assist you soon.